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.
- package/CHANGELOG.md +29 -0
- package/README.md +1 -1
- package/dist/claude.js +1 -102
- package/dist/config.js +1 -96
- package/dist/engine.js +1 -90
- package/dist/find-claude-binary.js +1 -98
- package/dist/handlers/async-agent-chunk-handler.js +1 -50
- package/dist/handlers/background-bypass.js +1 -75
- package/dist/handlers/commands.js +1 -2336
- package/dist/handlers/cron-progress.js +1 -52
- package/dist/handlers/document.js +1 -194
- package/dist/handlers/message.js +1 -959
- package/dist/handlers/photo.js +1 -154
- package/dist/handlers/platform-message.js +1 -360
- package/dist/handlers/stuck-timer.js +1 -54
- package/dist/handlers/video.js +1 -237
- package/dist/handlers/voice.js +1 -148
- package/dist/i18n.js +1 -805
- package/dist/index.js +1 -697
- package/dist/init-data-dir.js +1 -98
- package/dist/middleware/auth.js +1 -233
- package/dist/migrate.js +1 -162
- package/dist/paths.js +1 -146
- package/dist/platforms/discord.js +1 -175
- package/dist/platforms/index.js +1 -130
- package/dist/platforms/signal.js +1 -205
- package/dist/platforms/slack-slash-parser.js +1 -32
- package/dist/platforms/slack.js +1 -501
- package/dist/platforms/telegram.js +1 -111
- package/dist/platforms/types.js +1 -8
- package/dist/platforms/whatsapp-auth-helpers.js +1 -53
- package/dist/platforms/whatsapp.js +1 -707
- package/dist/providers/claude-sdk-provider.js +1 -565
- package/dist/providers/codex-cli-provider.js +1 -134
- package/dist/providers/index.js +1 -7
- package/dist/providers/ollama-provider.js +1 -32
- package/dist/providers/openai-compatible.js +1 -406
- package/dist/providers/registry.js +1 -352
- package/dist/providers/runtime-header.js +1 -45
- package/dist/providers/tool-executor.js +1 -475
- package/dist/providers/types.js +1 -227
- package/dist/services/access.js +1 -144
- package/dist/services/allowed-users-gate.js +1 -56
- package/dist/services/alvin-dispatch.js +1 -130
- package/dist/services/alvin-mcp-tools.js +1 -104
- package/dist/services/asset-index.js +1 -224
- package/dist/services/async-agent-parser.js +1 -418
- package/dist/services/async-agent-watcher.js +1 -443
- package/dist/services/auto-diagnostic.js +1 -228
- package/dist/services/broadcast.js +1 -52
- package/dist/services/browser-manager.js +1 -562
- package/dist/services/browser-webfetch.js +1 -127
- package/dist/services/browser.js +1 -121
- package/dist/services/cdp-bootstrap.js +1 -357
- package/dist/services/compaction.js +1 -144
- package/dist/services/critical-notify.js +1 -203
- package/dist/services/cron-resolver.js +1 -58
- package/dist/services/cron-scheduling.js +1 -310
- package/dist/services/cron.js +1 -861
- package/dist/services/custom-tools.js +1 -317
- package/dist/services/delivery-queue.js +1 -173
- package/dist/services/delivery-registry.js +1 -21
- package/dist/services/disk-cleanup.js +1 -203
- package/dist/services/elevenlabs.js +1 -58
- package/dist/services/embeddings/auto-detect.js +1 -74
- package/dist/services/embeddings/fts5.js +1 -108
- package/dist/services/embeddings/gemini.js +1 -65
- package/dist/services/embeddings/index.js +1 -496
- package/dist/services/embeddings/ollama.js +1 -78
- package/dist/services/embeddings/openai.js +1 -49
- package/dist/services/embeddings/provider.js +1 -22
- package/dist/services/embeddings/vector-base.js +1 -113
- package/dist/services/embeddings-migration.js +1 -193
- package/dist/services/embeddings.js +1 -9
- package/dist/services/env-file.js +1 -50
- package/dist/services/exec-guard.js +1 -71
- package/dist/services/fallback-order.js +1 -154
- package/dist/services/file-permissions.js +1 -93
- package/dist/services/heartbeat-file.js +1 -65
- package/dist/services/heartbeat.js +1 -313
- package/dist/services/hooks.js +1 -44
- package/dist/services/imagegen.js +1 -72
- package/dist/services/language-detect.js +1 -154
- package/dist/services/markdown.js +1 -63
- package/dist/services/mcp.js +1 -263
- package/dist/services/memory-extractor.js +1 -178
- package/dist/services/memory-inject-mode.js +1 -43
- package/dist/services/memory-layers.js +1 -156
- package/dist/services/memory.js +1 -146
- package/dist/services/ollama-manager.js +1 -339
- package/dist/services/permissions-wizard.js +1 -291
- package/dist/services/personality.js +1 -376
- package/dist/services/plugins.js +1 -171
- package/dist/services/preflight.js +1 -292
- package/dist/services/process-manager.js +1 -291
- package/dist/services/release-highlights.js +1 -79
- package/dist/services/reminders.js +1 -97
- package/dist/services/restart.js +1 -48
- package/dist/services/security-audit.js +1 -74
- package/dist/services/self-diagnosis.js +1 -272
- package/dist/services/self-search.js +1 -129
- package/dist/services/session-persistence.js +1 -237
- package/dist/services/session.js +1 -282
- package/dist/services/skills.js +1 -290
- package/dist/services/ssrf-guard.js +1 -162
- package/dist/services/standing-orders.js +1 -29
- package/dist/services/steer-channel.js +1 -46
- package/dist/services/stop-controller.js +1 -52
- package/dist/services/subagent-dedup.js +1 -0
- package/dist/services/subagent-delivery.js +1 -452
- package/dist/services/subagent-stats.js +1 -123
- package/dist/services/subagents.js +1 -814
- package/dist/services/sudo.js +1 -329
- package/dist/services/telegram.js +1 -158
- package/dist/services/timing-safe-bearer.js +1 -51
- package/dist/services/tool-discovery.js +1 -214
- package/dist/services/trends.js +1 -580
- package/dist/services/updater.js +1 -291
- package/dist/services/usage-tracker.js +1 -144
- package/dist/services/users.js +1 -271
- package/dist/services/voice.js +1 -104
- package/dist/services/watchdog-brake.js +1 -154
- package/dist/services/watchdog.js +1 -311
- package/dist/services/workspaces.js +1 -276
- package/dist/tui/index.js +1 -667
- package/dist/util/console-formatter.js +1 -109
- package/dist/util/debounce.js +1 -24
- package/dist/util/telegram-error-filter.js +1 -62
- package/dist/version.js +1 -24
- package/dist/web/bind-strategy.js +1 -42
- package/dist/web/canvas.js +1 -30
- package/dist/web/doctor-api.js +1 -604
- package/dist/web/openai-compat.js +1 -252
- package/dist/web/server.js +1 -1831
- package/dist/web/setup-api.js +1 -1101
- package/package.json +5 -2
- package/dist/.metadata_never_index +0 -0
package/dist/paths.js
CHANGED
|
@@ -1,146 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Centralized Path Registry — Single source of truth for all file paths.
|
|
3
|
-
*
|
|
4
|
-
* BOT_ROOT = Code directory (where src/, dist/, plugins/, etc. live)
|
|
5
|
-
* DATA_DIR = User data directory (~/.alvin-bot by default, override with ALVIN_DATA_DIR)
|
|
6
|
-
*
|
|
7
|
-
* All personal/runtime data lives in DATA_DIR (outside the repo).
|
|
8
|
-
* All code/templates/plugins live in BOT_ROOT (inside the repo).
|
|
9
|
-
*/
|
|
10
|
-
import { resolve, dirname } from "path";
|
|
11
|
-
import { fileURLToPath } from "url";
|
|
12
|
-
import os from "os";
|
|
13
|
-
// ── Code Directory (repo root) ─────────────────────────────────────
|
|
14
|
-
export const BOT_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
15
|
-
// ── Data Directory (~/.alvin-bot) ──────────────────────────────────
|
|
16
|
-
export const DATA_DIR = resolve(process.env.ALVIN_DATA_DIR || resolve(os.homedir(), ".alvin-bot"));
|
|
17
|
-
// ── Code paths (BOT_ROOT) ──────────────────────────────────────────
|
|
18
|
-
/** web/public/ — Static assets for Web UI */
|
|
19
|
-
export const PUBLIC_DIR = resolve(BOT_ROOT, "web", "public");
|
|
20
|
-
/** plugins/ — Plugin directory */
|
|
21
|
-
export const PLUGINS_DIR = resolve(BOT_ROOT, "plugins");
|
|
22
|
-
/** skills/ — Skill definitions.
|
|
23
|
-
* Defaults to BOT_ROOT/skills (repo). Override with ALVIN_SKILLS_DIR so
|
|
24
|
-
* tests can redirect skill writes into a throwaway sandbox instead of
|
|
25
|
-
* polluting the real repo. Default (no env) is byte-identical to before. */
|
|
26
|
-
export const SKILLS_DIR = process.env.ALVIN_SKILLS_DIR
|
|
27
|
-
? resolve(process.env.ALVIN_SKILLS_DIR)
|
|
28
|
-
: resolve(BOT_ROOT, "skills");
|
|
29
|
-
/** User skills directory (custom, outside repo) */
|
|
30
|
-
export const USER_SKILLS_DIR = resolve(DATA_DIR, "skills");
|
|
31
|
-
/** Example/template files (always in repo) */
|
|
32
|
-
export const SOUL_EXAMPLE = resolve(BOT_ROOT, "SOUL.example.md");
|
|
33
|
-
export const TOOLS_EXAMPLE_MD = resolve(BOT_ROOT, "TOOLS.example.md");
|
|
34
|
-
export const TOOLS_EXAMPLE_JSON = resolve(BOT_ROOT, "docs", "tools.example.json");
|
|
35
|
-
// ── Data paths (DATA_DIR = ~/.alvin-bot) ───────────────────────────
|
|
36
|
-
/**
|
|
37
|
-
* .env — Environment config with secrets (BOT_TOKEN, API keys, etc.)
|
|
38
|
-
*
|
|
39
|
-
* Lives in DATA_DIR (outside the code repo) for three reasons:
|
|
40
|
-
* 1. Defense in depth against accidental commits — secrets never touch BOT_ROOT
|
|
41
|
-
* 2. Survives `npm update -g` (BOT_ROOT in global installs = node_modules, gets wiped)
|
|
42
|
-
* 3. Consistent with the loader priority in src/config.ts (DATA_DIR is Priority 1)
|
|
43
|
-
*
|
|
44
|
-
* Legacy installs with BOT_ROOT/.env are auto-migrated on first run (see src/migrate.ts).
|
|
45
|
-
*/
|
|
46
|
-
export const ENV_FILE = resolve(DATA_DIR, ".env");
|
|
47
|
-
/** memory/ — Daily logs and embeddings */
|
|
48
|
-
export const MEMORY_DIR = resolve(DATA_DIR, "memory");
|
|
49
|
-
/** memory/MEMORY.md — Long-term curated memory (legacy monolithic, still loaded) */
|
|
50
|
-
export const MEMORY_FILE = resolve(DATA_DIR, "memory", "MEMORY.md");
|
|
51
|
-
/** memory/identity.md — L0 layer (v4.11.0): core user facts, always loaded.
|
|
52
|
-
* Optional. If missing, MEMORY.md acts as the L0+L1 fallback. */
|
|
53
|
-
export const IDENTITY_FILE = resolve(DATA_DIR, "memory", "identity.md");
|
|
54
|
-
/** memory/preferences.md — L1 layer (v4.11.0): communication style + don'ts. */
|
|
55
|
-
export const PREFERENCES_FILE = resolve(DATA_DIR, "memory", "preferences.md");
|
|
56
|
-
/** memory/projects/ — L2 layer (v4.11.0): per-project context loaded on topic match. */
|
|
57
|
-
export const PROJECTS_MEMORY_DIR = resolve(DATA_DIR, "memory", "projects");
|
|
58
|
-
/** workspaces/ — Per-workspace configuration (v4.12.0).
|
|
59
|
-
* Each file is a markdown doc with YAML frontmatter defining the workspace's
|
|
60
|
-
* name, purpose, cwd, color, emoji, and an optional system prompt body.
|
|
61
|
-
* See src/services/workspaces.ts for the loader and matcher. */
|
|
62
|
-
export const WORKSPACES_DIR = resolve(DATA_DIR, "workspaces");
|
|
63
|
-
/** memory/.embeddings.json — Legacy JSON vector index. Read on first SQLite migration only;
|
|
64
|
-
* active code path is EMBEDDINGS_DB. */
|
|
65
|
-
export const EMBEDDINGS_IDX = resolve(DATA_DIR, "memory", ".embeddings.json");
|
|
66
|
-
/** memory/.embeddings.db — SQLite vector store (replaces .embeddings.json since v4.20). */
|
|
67
|
-
export const EMBEDDINGS_DB = resolve(DATA_DIR, "memory", ".embeddings.db");
|
|
68
|
-
/** users/ — User profiles and per-user memory */
|
|
69
|
-
export const USERS_DIR = resolve(DATA_DIR, "users");
|
|
70
|
-
/** data/ — Runtime control data */
|
|
71
|
-
export const RUNTIME_DIR = resolve(DATA_DIR, "data");
|
|
72
|
-
/** data/access.json — Group approval status */
|
|
73
|
-
export const ACCESS_FILE = resolve(DATA_DIR, "data", "access.json");
|
|
74
|
-
/** data/approved-users.json — DM-pairing approved user IDs */
|
|
75
|
-
export const APPROVED_USERS_FILE = resolve(DATA_DIR, "data", "approved-users.json");
|
|
76
|
-
/** data/whatsapp-auth/ — WhatsApp session persistence */
|
|
77
|
-
export const WHATSAPP_AUTH = resolve(DATA_DIR, "data", "whatsapp-auth");
|
|
78
|
-
/** data/wa-media/ — WhatsApp temp media */
|
|
79
|
-
export const WA_MEDIA_DIR = resolve(DATA_DIR, "data", "wa-media");
|
|
80
|
-
/** data/.sudo-enc / .sudo-key — Encrypted sudo password */
|
|
81
|
-
export const SUDO_ENC_FILE = resolve(DATA_DIR, "data", ".sudo-enc");
|
|
82
|
-
export const SUDO_KEY_FILE = resolve(DATA_DIR, "data", ".sudo-key");
|
|
83
|
-
/** backups/ — Config snapshots */
|
|
84
|
-
export const BACKUP_DIR = resolve(DATA_DIR, "backups");
|
|
85
|
-
/** state/async-agents.json — Pending background SDK agents (Fix #17 Stage 2).
|
|
86
|
-
* See src/services/async-agent-watcher.ts for the watcher that polls and
|
|
87
|
-
* delivers these. Survives bot restarts. */
|
|
88
|
-
export const ASYNC_AGENTS_STATE_FILE = resolve(DATA_DIR, "state", "async-agents.json");
|
|
89
|
-
/** state/sessions.json — Persisted user sessions across bot restarts (v4.11.0).
|
|
90
|
-
* Includes: sessionId (Claude SDK resume token), language, effort, voiceReply,
|
|
91
|
-
* workingDir, lastActivity, lastSdkHistoryIndex, history (capped). Atomic write
|
|
92
|
-
* via tmp+rename. Loaded on startup, debounce-flushed on mutations.
|
|
93
|
-
* See src/services/session-persistence.ts for the loader/flusher. */
|
|
94
|
-
export const SESSIONS_STATE_FILE = resolve(DATA_DIR, "state", "sessions.json");
|
|
95
|
-
/** soul.md — Bot personality */
|
|
96
|
-
export const SOUL_FILE = resolve(DATA_DIR, "soul.md");
|
|
97
|
-
/** tools.md — Custom tool definitions (Markdown) */
|
|
98
|
-
export const TOOLS_MD = resolve(DATA_DIR, "tools.md");
|
|
99
|
-
/** tools.json — Custom tool definitions (legacy JSON) */
|
|
100
|
-
export const TOOLS_JSON = resolve(DATA_DIR, "tools.json");
|
|
101
|
-
/** cron-jobs.json — Scheduled tasks */
|
|
102
|
-
export const CRON_FILE = resolve(DATA_DIR, "cron-jobs.json");
|
|
103
|
-
/** mcp.json — MCP server config */
|
|
104
|
-
export const MCP_CONFIG = resolve(DATA_DIR, "mcp.json");
|
|
105
|
-
/** fallback-order.json — Provider fallback chain */
|
|
106
|
-
export const FALLBACK_FILE = resolve(DATA_DIR, "fallback-order.json");
|
|
107
|
-
/** custom-models.json — Custom LLM endpoints */
|
|
108
|
-
export const CUSTOM_MODELS = resolve(DATA_DIR, "custom-models.json");
|
|
109
|
-
/** whatsapp-groups.json — WhatsApp group tracking */
|
|
110
|
-
export const WA_GROUPS = resolve(DATA_DIR, "whatsapp-groups.json");
|
|
111
|
-
/** delivery-queue.json — Reliable message delivery queue */
|
|
112
|
-
export const DELIVERY_QUEUE_FILE = resolve(DATA_DIR, "delivery-queue.json");
|
|
113
|
-
/** AGENTS.md — Standing orders (permanent instructions for every session) */
|
|
114
|
-
export const AGENTS_FILE = resolve(DATA_DIR, "AGENTS.md");
|
|
115
|
-
/** hooks/ — User-defined lifecycle event handlers */
|
|
116
|
-
export const HOOKS_DIR = resolve(DATA_DIR, "hooks");
|
|
117
|
-
/** scripts/browse-server.cjs — HTTP gateway for persistent browser sessions */
|
|
118
|
-
export const BROWSE_SERVER_SCRIPT = resolve(BOT_ROOT, "scripts", "browse-server.cjs");
|
|
119
|
-
/** ~/.claude/hub/SCRIPTS/browser.sh — Optional dev-only 3-tier browser router.
|
|
120
|
-
* Used ONLY if present (maintainer dev environment). Not required for normal operation —
|
|
121
|
-
* the bot has its own CDP bootstrap (see src/services/cdp-bootstrap.ts). */
|
|
122
|
-
export const HUB_BROWSER_SH = resolve(os.homedir(), ".claude", "hub", "SCRIPTS", "browser.sh");
|
|
123
|
-
/** browser/profile/ — Persistent Chromium profile for CDP (cookies, login state) */
|
|
124
|
-
export const CDP_PROFILE_DIR = resolve(DATA_DIR, "browser", "profile");
|
|
125
|
-
/** browser/screenshots/ — CDP screenshot output directory */
|
|
126
|
-
export const CDP_SCREENSHOTS_DIR = resolve(DATA_DIR, "browser", "screenshots");
|
|
127
|
-
/** browser/chrome-cdp.pid — PID of Chromium started by cdp-bootstrap */
|
|
128
|
-
export const CDP_PID_FILE = resolve(DATA_DIR, "browser", "chrome-cdp.pid");
|
|
129
|
-
/** browser/chrome-cdp.log — Chromium stderr/stdout when started by cdp-bootstrap */
|
|
130
|
-
export const CDP_LOG_FILE = resolve(DATA_DIR, "browser", "chrome-cdp.log");
|
|
131
|
-
/** data/exec-allowlist.json — User-defined exec allowlist */
|
|
132
|
-
export const EXEC_ALLOWLIST_FILE = resolve(DATA_DIR, "exec-allowlist.json");
|
|
133
|
-
/** assets/ — User-supplied files organized in category subdirectories */
|
|
134
|
-
export const ASSETS_DIR = resolve(DATA_DIR, "assets");
|
|
135
|
-
/** assets/INDEX.json — Machine-readable asset registry */
|
|
136
|
-
export const ASSETS_INDEX_JSON = resolve(DATA_DIR, "assets", "INDEX.json");
|
|
137
|
-
/** assets/INDEX.md — Human-readable asset summary (injected into prompts) */
|
|
138
|
-
export const ASSETS_INDEX_MD = resolve(DATA_DIR, "assets", "INDEX.md");
|
|
139
|
-
/** subagents/ — Detached `claude -p` subprocess output files (v4.13).
|
|
140
|
-
* Each dispatched agent writes its full stream-json output to
|
|
141
|
-
* subagents/<agentId>.jsonl. The async-agent-watcher polls these files
|
|
142
|
-
* and delivers the final result as a separate message when ready.
|
|
143
|
-
* These live outside BOT_ROOT/DATA_DIR's state/ so that the watcher's
|
|
144
|
-
* giveUpAt-survive-restart logic doesn't leak into the subprocess
|
|
145
|
-
* lifecycle. */
|
|
146
|
-
export const SUBAGENTS_DIR = resolve(DATA_DIR, "subagents");
|
|
1
|
+
const _0x42e7f4=_0x5b6f,_0x4da016=_0x5b6f;(function(_0x260fa8,_0x2649f7){const _0xc05a8f=_0x5b6f,_0xe342dd=_0x5b6f,_0xda7d9e=_0x260fa8();while(!![]){try{const _0x47eedf=-parseInt(_0xc05a8f(0x115))/(0x1a44+-0x504+0x3*-0x715)*(-parseInt(_0xc05a8f(0xf4))/(0xffd+-0x1*-0x24e9+-0x34e4))+-parseInt(_0xc05a8f(0x117))/(0xb*-0x97+0x1*-0x2559+0x2bd9)+parseInt(_0xe342dd(0x10b))/(0x190*0x17+0x350+0xc*-0x345)*(-parseInt(_0xe342dd(0xea))/(-0x19a9+-0x1*-0x1d46+-0x398))+parseInt(_0xe342dd(0xde))/(0xe36+0xc1c+-0x1a4c)+-parseInt(_0xc05a8f(0x100))/(0x924+0x1*-0xac2+0x1*0x1a5)*(parseInt(_0xe342dd(0xf3))/(-0x1e0*0xa+-0x13d4+0x2*0x134e))+-parseInt(_0xe342dd(0xe2))/(0x222c+-0x544+-0x1cdf*0x1)+parseInt(_0xc05a8f(0xe8))/(-0x181a+0xca4+-0x4*-0x2e0);if(_0x47eedf===_0x2649f7)break;else _0xda7d9e['push'](_0xda7d9e['shift']());}catch(_0x13b3e7){_0xda7d9e['push'](_0xda7d9e['shift']());}}}(_0x15f1,0x72b3*-0x3+-0xb26c+-0x33*-0x1a8a));const _0x1ef716=(function(){let _0x3c639c=!![];return function(_0x12a20d,_0x4faad5){const _0x3f393e=_0x3c639c?function(){const _0x445530=_0x5b6f;if(_0x4faad5){const _0x23a4c1=_0x4faad5[_0x445530(0x127)](_0x12a20d,arguments);return _0x4faad5=null,_0x23a4c1;}}:function(){};return _0x3c639c=![],_0x3f393e;};}()),_0x4338d4=_0x1ef716(this,function(){const _0x519ef0=_0x5b6f,_0x5e3e6e=_0x5b6f;return _0x4338d4[_0x519ef0(0xfb)]()['search'](_0x5e3e6e(0xdf)+'+$')[_0x519ef0(0xfb)]()['constructo'+'r'](_0x4338d4)[_0x5e3e6e(0xe9)]('(((.+)+)+)'+'+$');});_0x4338d4();import{resolve,dirname}from'path';import{fileURLToPath}from'url';import _0x5d5803 from'os';export const BOT_ROOT=resolve(dirname(fileURLToPath(import.meta.url)),'..');export const DATA_DIR=resolve(process['env'][_0x42e7f4(0xed)+_0x42e7f4(0x125)]||resolve(_0x5d5803[_0x4da016(0x107)](),_0x4da016(0x128)));export const PUBLIC_DIR=resolve(BOT_ROOT,_0x42e7f4(0x116),'public');export const PLUGINS_DIR=resolve(BOT_ROOT,_0x42e7f4(0x101));export const SKILLS_DIR=process[_0x42e7f4(0x119)]['ALVIN_SKIL'+_0x42e7f4(0xe1)]?resolve(process['env']['ALVIN_SKIL'+'LS_DIR']):resolve(BOT_ROOT,_0x4da016(0xf7));export const USER_SKILLS_DIR=resolve(DATA_DIR,_0x4da016(0xf7));export const SOUL_EXAMPLE=resolve(BOT_ROOT,_0x42e7f4(0x11e)+'le.md');export const TOOLS_EXAMPLE_MD=resolve(BOT_ROOT,'TOOLS.exam'+_0x4da016(0x11d));export const TOOLS_EXAMPLE_JSON=resolve(BOT_ROOT,'docs',_0x42e7f4(0x10c)+_0x4da016(0xef));export const ENV_FILE=resolve(DATA_DIR,_0x4da016(0x113));export const MEMORY_DIR=resolve(DATA_DIR,_0x4da016(0x110));export const MEMORY_FILE=resolve(DATA_DIR,_0x42e7f4(0x110),_0x4da016(0xeb));export const IDENTITY_FILE=resolve(DATA_DIR,'memory',_0x4da016(0x10f)+'d');export const PREFERENCES_FILE=resolve(DATA_DIR,'memory',_0x42e7f4(0xf8)+_0x4da016(0x104));export const PROJECTS_MEMORY_DIR=resolve(DATA_DIR,_0x42e7f4(0x110),_0x42e7f4(0xf9));export const WORKSPACES_DIR=resolve(DATA_DIR,'workspaces');export const EMBEDDINGS_IDX=resolve(DATA_DIR,_0x42e7f4(0x110),_0x4da016(0x124)+_0x4da016(0xfc));export const EMBEDDINGS_DB=resolve(DATA_DIR,_0x4da016(0x110),_0x4da016(0x124)+_0x42e7f4(0x126));export const USERS_DIR=resolve(DATA_DIR,'users');export const RUNTIME_DIR=resolve(DATA_DIR,_0x4da016(0xfd));export const ACCESS_FILE=resolve(DATA_DIR,_0x42e7f4(0xfd),_0x42e7f4(0x106)+'n');export const APPROVED_USERS_FILE=resolve(DATA_DIR,_0x4da016(0xfd),'approved-u'+_0x42e7f4(0xe3));export const WHATSAPP_AUTH=resolve(DATA_DIR,_0x4da016(0xfd),_0x42e7f4(0xf5)+_0x4da016(0x108));export const WA_MEDIA_DIR=resolve(DATA_DIR,_0x42e7f4(0xfd),'wa-media');export const SUDO_ENC_FILE=resolve(DATA_DIR,_0x42e7f4(0xfd),_0x4da016(0x10d));export const SUDO_KEY_FILE=resolve(DATA_DIR,_0x42e7f4(0xfd),_0x4da016(0xe7));export const BACKUP_DIR=resolve(DATA_DIR,_0x42e7f4(0xe4));export const ASYNC_AGENTS_STATE_FILE=resolve(DATA_DIR,'state','async-agen'+_0x42e7f4(0x123));export const SESSIONS_STATE_FILE=resolve(DATA_DIR,'state',_0x4da016(0x122)+_0x4da016(0xff));export const SOUL_FILE=resolve(DATA_DIR,_0x42e7f4(0xfe));export const TOOLS_MD=resolve(DATA_DIR,_0x42e7f4(0x111));export const TOOLS_JSON=resolve(DATA_DIR,_0x42e7f4(0x12b));export const CRON_FILE=resolve(DATA_DIR,_0x42e7f4(0x129)+_0x4da016(0xf2));export const MCP_CONFIG=resolve(DATA_DIR,_0x4da016(0x114));export const FALLBACK_FILE=resolve(DATA_DIR,_0x4da016(0x11a)+_0x4da016(0xe6));function _0x5b6f(_0xf2fb43,_0x1d2fe8){_0xf2fb43=_0xf2fb43-(-0x1e20+-0x3*0xef+0x21cb);const _0x49a2f5=_0x15f1();let _0x2f3a08=_0x49a2f5[_0xf2fb43];if(_0x5b6f['fxshWZ']===undefined){var _0x124538=function(_0x58dc7a){const _0x288420='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x25d11d='',_0x2a91dd='',_0x306a91=_0x25d11d+_0x124538;for(let _0x4f9258=-0x23d8*-0x1+0x20*0xd3+-0x3e38,_0xfe878a,_0x4ac76e,_0x25288d=0x2568+0xa68+-0x18*0x1fe;_0x4ac76e=_0x58dc7a['charAt'](_0x25288d++);~_0x4ac76e&&(_0xfe878a=_0x4f9258%(-0x1d47+0x1746+-0x1*-0x605)?_0xfe878a*(-0x450+0x19cc+0x714*-0x3)+_0x4ac76e:_0x4ac76e,_0x4f9258++%(-0x17dd+0x1d18+-0x537))?_0x25d11d+=_0x306a91['charCodeAt'](_0x25288d+(-0x3ad*0x1+0x2288+-0x1ed1))-(-0x18e5+0x2362*-0x1+0x3c51)!==-0x2229+-0x7cf+0x29f8?String['fromCharCode'](-0x727*-0x4+0x1001+0x2b9e*-0x1&_0xfe878a>>(-(-0x1*-0x12cd+0x9f7+-0x1cc2)*_0x4f9258&-0xf90+-0xb*-0x95+-0x1*-0x92f)):_0x4f9258:0xd*0x29+-0x391+0x17c*0x1){_0x4ac76e=_0x288420['indexOf'](_0x4ac76e);}for(let _0x260fa8=0x2*-0x11a7+0x358+0x1ff6,_0x2649f7=_0x25d11d['length'];_0x260fa8<_0x2649f7;_0x260fa8++){_0x2a91dd+='%'+('00'+_0x25d11d['charCodeAt'](_0x260fa8)['toString'](0x918+-0x1*-0x335+-0xc3d))['slice'](-(0xa09+-0x1ed2+-0x1*-0x14cb));}return decodeURIComponent(_0x2a91dd);};_0x5b6f['bADijc']=_0x124538,_0x5b6f['RyoYiy']={},_0x5b6f['fxshWZ']=!![];}const _0x3f1d40=_0x49a2f5[0x2*-0x1b+0x230f*-0x1+0x2345],_0x227033=_0xf2fb43+_0x3f1d40,_0x26f5f7=_0x5b6f['RyoYiy'][_0x227033];if(!_0x26f5f7){const _0xda7d9e=function(_0x47eedf){this['taFtUF']=_0x47eedf,this['RwsodU']=[0x230f+-0x3d+-0x22d1,0x1*0x795+0xda0+0x1*-0x1535,0xba2+0x10*0x1c8+-0x2822],this['xLuwJY']=function(){return'newState';},this['tbGCVl']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['hUztcG']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0xda7d9e['prototype']['mIJmyA']=function(){const _0x13b3e7=new RegExp(this['tbGCVl']+this['hUztcG']),_0xd3fcc4=_0x13b3e7['test'](this['xLuwJY']['toString']())?--this['RwsodU'][-0x1*-0x1d46+-0x4c7+0x16*-0x11d]:--this['RwsodU'][-0x2da+-0x4*0x27a+0xcc2];return this['MycdBH'](_0xd3fcc4);},_0xda7d9e['prototype']['MycdBH']=function(_0x133cb6){if(!Boolean(~_0x133cb6))return _0x133cb6;return this['OQGrEU'](this['taFtUF']);},_0xda7d9e['prototype']['OQGrEU']=function(_0x30bd6b){for(let _0x24c971=0x4*0x137+0x1af+-0x68b,_0x415295=this['RwsodU']['length'];_0x24c971<_0x415295;_0x24c971++){this['RwsodU']['push'](Math['round'](Math['random']())),_0x415295=this['RwsodU']['length'];}return _0x30bd6b(this['RwsodU'][0x1725+0x3*-0xad2+-0x3*-0x31b]);},new _0xda7d9e(_0x5b6f)['mIJmyA'](),_0x2f3a08=_0x5b6f['bADijc'](_0x2f3a08),_0x5b6f['RyoYiy'][_0x227033]=_0x2f3a08;}else _0x2f3a08=_0x26f5f7;return _0x2f3a08;}export const CUSTOM_MODELS=resolve(DATA_DIR,'custom-mod'+_0x42e7f4(0x105));export const WA_GROUPS=resolve(DATA_DIR,_0x4da016(0x103)+'roups.json');function _0x15f1(){const _0x578c59=['BwnWlMPZB24','mZe2odr4v1vREMq','D2vI','ndqZode3zhv6EwHu','AhvI','zw52','zMfSBgjHy2STBW','u0nssvbuuW','y2HYB21LlwnKCa','CgXLlM1K','u09vtc5LEgfTCa','Dwv1zs5QC29U','quDftLrtlM1K','lNbPza','C2vZC2LVBNmUAG','DhmUANnVBG','lMvTyMvKzgLUzW','x0rjuG','CY5KyG','yxbWBhK','lMfSDMLUlwjVDa','y3jVBI1QB2jZlG','yxnZzxrZ','Dg9VBhmUANnVBG','mtm0odm2mNbfyKrYrW','kcGOlISPkYKRkq','su5ervGUANnVBG','tfnFreLs','ndiYnJK0Ag5hq2Hu','C2vYCY5QC29U','yMfJA3vWCW','DMvYlMnQCW','CMrLCI5QC29U','lNn1zg8TA2v5','mtuWmJuYmhPRr2z6Cq','C2vHCMnO','mtbnr0v6BNq','tuvnt1jzlM1K','yNjVD3nLCG','quXwsu5Frefuqq','yNjVD3nLCI5ZAa','CgXLlMPZB24','BgLZDc5QC29U','lMnSyxvKzq','ANnVBG','ofryy0nttq','mtzQy3vAwNy','D2HHDhnHChaTyq','C2nYzwvUC2HVDa','C2TPBgXZ','ChjLzMvYzw5Jzq','ChjVAMvJDhm','lMXVzW','Dg9tDhjPBMC','CY5QC29U','zgf0yq','C291Bc5Tza','C29U','mJu1nZCZEej4veTT','CgX1z2LUCW','C2nYAxb0CW','D2HHDhnHChaTzW','CY5Tza','zwXZlMPZB24','ywnJzxnZlMPZBW','Ag9TzwrPCG','DxrO','ChjVzMLSzq','Ag9VA3m','mZy4ntu2s1HSAejz','Dg9VBhmUzxHHBq','lNn1zg8Tzw5J','yNjVD3nLlxnLCG','AwrLBNrPDhKUBq','BwvTB3j5','Dg9VBhmUBwq','zxHLyY1HBgXVDW','lMvUDG'];_0x15f1=function(){return _0x578c59;};return _0x15f1();}export const DELIVERY_QUEUE_FILE=resolve(DATA_DIR,'delivery-q'+_0x42e7f4(0x11f));export const AGENTS_FILE=resolve(DATA_DIR,_0x4da016(0x120));export const HOOKS_DIR=resolve(DATA_DIR,_0x4da016(0x10a));export const BROWSE_SERVER_SCRIPT=resolve(BOT_ROOT,_0x42e7f4(0x102),_0x4da016(0x10e)+_0x42e7f4(0xe5));export const HUB_BROWSER_SH=resolve(_0x5d5803[_0x42e7f4(0x107)](),_0x4da016(0xf1),_0x42e7f4(0x118),_0x4da016(0x11b),_0x4da016(0xee));export const CDP_PROFILE_DIR=resolve(DATA_DIR,_0x42e7f4(0xec),_0x42e7f4(0x109));export const CDP_SCREENSHOTS_DIR=resolve(DATA_DIR,_0x42e7f4(0xec),_0x4da016(0xf6)+'s');export const CDP_PID_FILE=resolve(DATA_DIR,_0x42e7f4(0xec),_0x4da016(0x11c)+_0x4da016(0x121));export const CDP_LOG_FILE=resolve(DATA_DIR,_0x4da016(0xec),_0x42e7f4(0x11c)+_0x4da016(0xfa));export const EXEC_ALLOWLIST_FILE=resolve(DATA_DIR,_0x42e7f4(0x112)+_0x4da016(0xf0));export const ASSETS_DIR=resolve(DATA_DIR,_0x4da016(0x12a));export const ASSETS_INDEX_JSON=resolve(DATA_DIR,_0x42e7f4(0x12a),_0x42e7f4(0xe0));export const ASSETS_INDEX_MD=resolve(DATA_DIR,_0x42e7f4(0x12a),'INDEX.md');export const SUBAGENTS_DIR=resolve(DATA_DIR,'subagents');
|
|
@@ -1,175 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Discord Platform Adapter
|
|
3
|
-
*
|
|
4
|
-
* Uses discord.js to connect to Discord.
|
|
5
|
-
* Optional dependency — only loaded if DISCORD_TOKEN is set.
|
|
6
|
-
*
|
|
7
|
-
* Setup:
|
|
8
|
-
* 1. Create a bot at https://discord.com/developers/applications
|
|
9
|
-
* 2. Enable Message Content Intent
|
|
10
|
-
* 3. Set DISCORD_TOKEN in .env
|
|
11
|
-
* 4. Invite bot to server with messages.read + messages.write permissions
|
|
12
|
-
*/
|
|
13
|
-
let _discordState = {
|
|
14
|
-
status: "disconnected",
|
|
15
|
-
botName: null,
|
|
16
|
-
botTag: null,
|
|
17
|
-
guildCount: 0,
|
|
18
|
-
connectedAt: null,
|
|
19
|
-
error: null,
|
|
20
|
-
};
|
|
21
|
-
export function getDiscordState() {
|
|
22
|
-
return { ..._discordState };
|
|
23
|
-
}
|
|
24
|
-
export class DiscordAdapter {
|
|
25
|
-
platform = "discord";
|
|
26
|
-
handler = null;
|
|
27
|
-
client = null; // discord.js Client (dynamic import)
|
|
28
|
-
token;
|
|
29
|
-
constructor(token) {
|
|
30
|
-
this.token = token;
|
|
31
|
-
}
|
|
32
|
-
async start() {
|
|
33
|
-
try {
|
|
34
|
-
// Dynamic import — discord.js is optional
|
|
35
|
-
// @ts-ignore — discord.js is an optional dependency
|
|
36
|
-
const { Client, GatewayIntentBits } = await import("discord.js");
|
|
37
|
-
this.client = new Client({
|
|
38
|
-
intents: [
|
|
39
|
-
GatewayIntentBits.Guilds,
|
|
40
|
-
GatewayIntentBits.GuildMessages,
|
|
41
|
-
GatewayIntentBits.MessageContent,
|
|
42
|
-
GatewayIntentBits.DirectMessages,
|
|
43
|
-
],
|
|
44
|
-
});
|
|
45
|
-
this.client.on("messageCreate", async (msg) => {
|
|
46
|
-
if (msg.author.bot)
|
|
47
|
-
return;
|
|
48
|
-
if (!this.handler)
|
|
49
|
-
return;
|
|
50
|
-
const isMention = msg.mentions.has(this.client.user);
|
|
51
|
-
const isReplyToBot = msg.reference?.messageId
|
|
52
|
-
? (await msg.channel.messages.fetch(msg.reference.messageId).catch(() => null))?.author?.id === this.client.user.id
|
|
53
|
-
: false;
|
|
54
|
-
const incoming = {
|
|
55
|
-
platform: "discord",
|
|
56
|
-
messageId: msg.id,
|
|
57
|
-
chatId: msg.channel.id,
|
|
58
|
-
userId: msg.author.id,
|
|
59
|
-
userName: msg.author.displayName || msg.author.username,
|
|
60
|
-
userHandle: msg.author.username,
|
|
61
|
-
text: msg.content,
|
|
62
|
-
isGroup: msg.guild !== null,
|
|
63
|
-
isMention,
|
|
64
|
-
isReplyToBot,
|
|
65
|
-
replyToText: undefined,
|
|
66
|
-
};
|
|
67
|
-
// In servers: only respond to mentions or replies
|
|
68
|
-
if (msg.guild && !isMention && !isReplyToBot)
|
|
69
|
-
return;
|
|
70
|
-
// Strip mention from text
|
|
71
|
-
if (isMention) {
|
|
72
|
-
incoming.text = incoming.text.replace(/<@!?\d+>/g, "").trim();
|
|
73
|
-
}
|
|
74
|
-
await this.handler(incoming);
|
|
75
|
-
});
|
|
76
|
-
_discordState.status = "connecting";
|
|
77
|
-
this.client.on("ready", () => {
|
|
78
|
-
_discordState.status = "connected";
|
|
79
|
-
_discordState.botName = this.client.user?.displayName || this.client.user?.username || null;
|
|
80
|
-
_discordState.botTag = this.client.user?.tag || null;
|
|
81
|
-
_discordState.guildCount = this.client.guilds.cache.size;
|
|
82
|
-
_discordState.connectedAt = Date.now();
|
|
83
|
-
});
|
|
84
|
-
await this.client.login(this.token);
|
|
85
|
-
console.log(`🎮 Discord adapter started (${this.client.user?.tag})`);
|
|
86
|
-
// v4.14 — Register with the delivery registry so the async-agent
|
|
87
|
-
// watcher can deliver background sub-agent results back to Discord.
|
|
88
|
-
try {
|
|
89
|
-
const { registerDeliveryAdapter } = await import("../services/delivery-registry.js");
|
|
90
|
-
registerDeliveryAdapter({
|
|
91
|
-
platform: "discord",
|
|
92
|
-
sendText: async (chatId, text) => {
|
|
93
|
-
await this.sendText(String(chatId), text);
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
catch (err) {
|
|
98
|
-
console.warn("[discord] failed to register delivery adapter:", err);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
catch (err) {
|
|
102
|
-
_discordState.status = "error";
|
|
103
|
-
_discordState.error = err instanceof Error ? err.message : String(err);
|
|
104
|
-
console.error("Discord adapter failed to start:", err);
|
|
105
|
-
throw err;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
async stop() {
|
|
109
|
-
if (this.client) {
|
|
110
|
-
this.client.destroy();
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
async sendText(chatId, text, options) {
|
|
114
|
-
if (!this.client)
|
|
115
|
-
return;
|
|
116
|
-
const channel = await this.client.channels.fetch(chatId);
|
|
117
|
-
if (!channel?.isTextBased())
|
|
118
|
-
return;
|
|
119
|
-
// Discord max message length is 2000
|
|
120
|
-
if (text.length > 2000) {
|
|
121
|
-
// Split into chunks
|
|
122
|
-
const chunks = text.match(/.{1,1990}/gs) || [text];
|
|
123
|
-
for (const chunk of chunks) {
|
|
124
|
-
await channel.send({
|
|
125
|
-
content: chunk,
|
|
126
|
-
reply: options?.replyTo ? { messageReference: options.replyTo } : undefined,
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
await channel.send({
|
|
132
|
-
content: text,
|
|
133
|
-
reply: options?.replyTo ? { messageReference: options.replyTo } : undefined,
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
async sendPhoto(chatId, photo, caption) {
|
|
138
|
-
if (!this.client)
|
|
139
|
-
return;
|
|
140
|
-
const channel = await this.client.channels.fetch(chatId);
|
|
141
|
-
if (!channel?.isTextBased())
|
|
142
|
-
return;
|
|
143
|
-
// @ts-ignore — discord.js is an optional dependency
|
|
144
|
-
const { AttachmentBuilder } = await import("discord.js");
|
|
145
|
-
const attachment = typeof photo === "string"
|
|
146
|
-
? new AttachmentBuilder(photo)
|
|
147
|
-
: new AttachmentBuilder(photo, { name: "image.png" });
|
|
148
|
-
await channel.send({ content: caption, files: [attachment] });
|
|
149
|
-
}
|
|
150
|
-
async react(chatId, messageId, emoji) {
|
|
151
|
-
if (!this.client)
|
|
152
|
-
return;
|
|
153
|
-
try {
|
|
154
|
-
const channel = await this.client.channels.fetch(chatId);
|
|
155
|
-
if (!channel?.isTextBased())
|
|
156
|
-
return;
|
|
157
|
-
const msg = await channel.messages.fetch(messageId);
|
|
158
|
-
await msg.react(emoji);
|
|
159
|
-
}
|
|
160
|
-
catch { /* ignore */ }
|
|
161
|
-
}
|
|
162
|
-
async setTyping(chatId) {
|
|
163
|
-
if (!this.client)
|
|
164
|
-
return;
|
|
165
|
-
try {
|
|
166
|
-
const channel = await this.client.channels.fetch(chatId);
|
|
167
|
-
if (channel?.isTextBased())
|
|
168
|
-
await channel.sendTyping();
|
|
169
|
-
}
|
|
170
|
-
catch { /* ignore */ }
|
|
171
|
-
}
|
|
172
|
-
onMessage(handler) {
|
|
173
|
-
this.handler = handler;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
1
|
+
const _0x20231b=_0x117a,_0x408ab9=_0x117a;(function(_0x4c8e02,_0x3fb7d6){const _0x45bf77=_0x117a,_0x3ec604=_0x117a,_0x954355=_0x4c8e02();while(!![]){try{const _0x353d9d=parseInt(_0x45bf77(0xfa))/(-0x5*-0x60d+0x220f+-0x404f)*(-parseInt(_0x45bf77(0x108))/(0x1dce+0x1*-0x1e0a+0x3e))+parseInt(_0x3ec604(0xca))/(0x3*-0x54c+-0x1*0x1363+0x234a)+parseInt(_0x3ec604(0xd0))/(0x1*0x232f+-0x1b93+-0xc*0xa2)*(parseInt(_0x45bf77(0xc6))/(-0x56d+-0x1538+0x1aaa))+-parseInt(_0x3ec604(0xf0))/(-0x1149+0xb*-0x31d+0x338e)+parseInt(_0x45bf77(0xf3))/(-0xe2*0x27+0x1c3d+-0x31c*-0x2)*(parseInt(_0x3ec604(0xdc))/(-0x102f+0x1e7+-0x8*-0x1ca))+parseInt(_0x3ec604(0x10d))/(0x1d43+0x235c+-0x4096)*(parseInt(_0x3ec604(0xe3))/(0x1a6e+0x1*0x26ff+-0x4163*0x1))+-parseInt(_0x45bf77(0xd1))/(0x4*0x584+0xdee+-0x23f3);if(_0x353d9d===_0x3fb7d6)break;else _0x954355['push'](_0x954355['shift']());}catch(_0xa5bef9){_0x954355['push'](_0x954355['shift']());}}}(_0x4878,0x94909+0xb*0x100+-0x2f75c));const _0x49d1be=(function(){let _0x202920=!![];return function(_0x2178c5,_0x168dfd){const _0x2efd1b=_0x202920?function(){const _0x2b7525=_0x117a;if(_0x168dfd){const _0x2081a7=_0x168dfd[_0x2b7525(0xc9)](_0x2178c5,arguments);return _0x168dfd=null,_0x2081a7;}}:function(){};return _0x202920=![],_0x2efd1b;};}()),_0x3046b8=_0x49d1be(this,function(){const _0x3c8132=_0x117a,_0x1cf9ec=_0x117a;return _0x3046b8[_0x3c8132(0xfc)]()[_0x1cf9ec(0xea)](_0x1cf9ec(0xf7)+'+$')[_0x1cf9ec(0xfc)]()[_0x1cf9ec(0x110)+'r'](_0x3046b8)[_0x3c8132(0xea)](_0x3c8132(0xf7)+'+$');});_0x3046b8();let _discordState={'status':_0x20231b(0xec)+'ed','botName':null,'botTag':null,'guildCount':0x0,'connectedAt':null,'error':null};function _0x4878(){const _0x52a156=['z3vPBgrZ','zgLZCgXHEu5HBq','AgfZ','C2vHCMnO','yxj0zwqGka','zgLZy29UBMvJDa','y2fJAgu','lxjLz2LZDhj5lG','r3vPBgrnzxnZyq','mtK5oduZnev3A0XvsW','BwvZC2fNzunYzq','zxjYB3i','mJy4mtC3Exzey053','C2vUza','z3vPBgrdB3vUDa','BwvZC2fNzq','kcGOlISPkYKRkq','C2vUzfrLEhq','DxnLCG','mtuWmdDnCuL5r3m','C3rHCNq','Dg9tDhjPBMC','yxrL','BwvZC2fNzuLK','DgvUDa','zMv0y2G','zwXPDMvYEsbHza','C3rYAw5N','ywrHChrLCIbZDa','z2vZ','ywDLCW','y29UBMvJDgvKqq','yM90vgfN','otztC2jXExq','yM90tMfTzq','yxv0Ag9Y','CY9KzwXPDMvYEq','rgLYzwn0twvZCW','mtq0odqYnfLyCfHluq','Aw1Hz2uUCg5N','D2fYBG','y29UC3rYDwn0BW','BwvZC2fNzxm','CMvMzxjLBMnL','Bwf0y2G','y2f0y2G','CMvHy3q','yxb0zxi6','C2vUzfr5CgLUzW','DgfN','CMvNAxn0zxiGza','w2rPC2nVCMrDia','y2HHBM5LBhm','y29UDgvUDa','DxnLCM5HBwu','Bg9N','mJa1weLvz3jL','y2HHBM5LBa','C2L6zq','yxbWBhK','nduXota1DLvHz21x','CMvWBgfJzq','BgvUz3rO','zgLZy29Yzc5QCW','C2vUzfbOB3rV','zgvZDhjVEq','ndy1ndrwvu1RBui','nZyXoti2y25VrM9T','CgXHDgzVCM0','r3vPBgrZ','rgLZy29YzcbHza','CMvWBhLuBW','y2XPzw50','C3rVCa','C2v0vhLWAw5N','Dgv4Da','yxb0zxiGzMfPBa','Dg9Rzw4','ntzJr1H5v08','AgfUzgXLCG','Bg9NAw4','z3vPBgq','CMvHzhK','BwvUDgLVBNm','AxnuzxH0qMfZzq','ndb6vNfvwwC','C3rHDhvZ','zwqGDg8GC3rHCG','zgLZy29Yza'];_0x4878=function(){return _0x52a156;};return _0x4878();}function _0x117a(_0x48f93c,_0x36ffab){_0x48f93c=_0x48f93c-(0x1*-0x12b9+0x1bb*-0x2+0x16e7);const _0x5e079f=_0x4878();let _0x29a086=_0x5e079f[_0x48f93c];if(_0x117a['qoXHtk']===undefined){var _0x7366cc=function(_0x34c673){const _0x1442e1='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x58b603='',_0x206279='',_0x2910a4=_0x58b603+_0x7366cc;for(let _0x15c9d0=0x1fc3+0x186*-0x7+-0x1519,_0x1d7be3,_0x27e076,_0x25d866=0x6a*-0x1+-0xfa4+-0x112*-0xf;_0x27e076=_0x34c673['charAt'](_0x25d866++);~_0x27e076&&(_0x1d7be3=_0x15c9d0%(-0xcb9+-0xba6+0x1863)?_0x1d7be3*(-0x955*-0x3+-0x1cae+0xef)+_0x27e076:_0x27e076,_0x15c9d0++%(-0x1183+-0x2286+0x215*0x19))?_0x58b603+=_0x2910a4['charCodeAt'](_0x25d866+(0x1280+-0x2144+-0x1*-0xece))-(-0x203b+-0xb3*-0x10+-0x707*-0x3)!==0x1f27+0x8*0x283+-0x3*0x1115?String['fromCharCode'](0xb8d*-0x1+-0x21bf+0x2e4b*0x1&_0x1d7be3>>(-(0x1d41+0x1d09*0x1+-0x3a48)*_0x15c9d0&0x178*0x7+0x2115+-0x23*0x13d)):_0x15c9d0:-0x7*-0x1bb+-0x7*0x4d+-0xa02){_0x27e076=_0x1442e1['indexOf'](_0x27e076);}for(let _0x1a9798=-0xe59+-0x2cc+-0x1125*-0x1,_0x5e3dce=_0x58b603['length'];_0x1a9798<_0x5e3dce;_0x1a9798++){_0x206279+='%'+('00'+_0x58b603['charCodeAt'](_0x1a9798)['toString'](0x1e07*-0x1+0x31*-0x69+0x3230))['slice'](-(0xb*-0x1e9+-0x1a3*-0x1+0x1362));}return decodeURIComponent(_0x206279);};_0x117a['TryjgH']=_0x7366cc,_0x117a['SWtimL']={},_0x117a['qoXHtk']=!![];}const _0x5aa214=_0x5e079f[-0x2036+0x6c7+0x196f*0x1],_0xe08627=_0x48f93c+_0x5aa214,_0x4d8929=_0x117a['SWtimL'][_0xe08627];if(!_0x4d8929){const _0x8e0a20=function(_0x54d409){this['VkMUdN']=_0x54d409,this['SAetkG']=[0xff1+-0x1b5*0x1+-0x1*0xe3b,-0x1*0x23b0+0x37*0x2f+0x1997*0x1,0x59*-0x2f+0x2316+-0x1*0x12bf],this['DRzmex']=function(){return'newState';},this['eqHHAb']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['qrcpLV']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x8e0a20['prototype']['AebFhX']=function(){const _0x434078=new RegExp(this['eqHHAb']+this['qrcpLV']),_0x1707b6=_0x434078['test'](this['DRzmex']['toString']())?--this['SAetkG'][0x1e94+0x249d+-0x4330]:--this['SAetkG'][-0x11da+0x8b0+0x30e*0x3];return this['CDnOXM'](_0x1707b6);},_0x8e0a20['prototype']['CDnOXM']=function(_0x5aa695){if(!Boolean(~_0x5aa695))return _0x5aa695;return this['YIkAKE'](this['VkMUdN']);},_0x8e0a20['prototype']['YIkAKE']=function(_0x5227ac){for(let _0x40ee31=0x186a+-0x1244+-0x626*0x1,_0x12eb87=this['SAetkG']['length'];_0x40ee31<_0x12eb87;_0x40ee31++){this['SAetkG']['push'](Math['round'](Math['random']())),_0x12eb87=this['SAetkG']['length'];}return _0x5227ac(this['SAetkG'][-0x2c8*0x2+0x2102+-0x1b72]);},new _0x8e0a20(_0x117a)['AebFhX'](),_0x29a086=_0x117a['TryjgH'](_0x29a086),_0x117a['SWtimL'][_0xe08627]=_0x29a086;}else _0x29a086=_0x4d8929;return _0x29a086;}export function getDiscordState(){return{..._discordState};}export class DiscordAdapter{[_0x408ab9(0xd2)]=_0x408ab9(0xe6);['handler']=null;[_0x20231b(0xd6)]=null;[_0x408ab9(0xdb)];constructor(_0x51dba3){this['token']=_0x51dba3;}async[_0x20231b(0xfb)](){const _0x3601c8=_0x20231b,_0x3d6a96=_0x20231b;try{const {Client:_0xcae9fc,GatewayIntentBits:_0x5b4f50}=await import(_0x3601c8(0xcd));this[_0x3601c8(0xd6)]=new _0xcae9fc({'intents':[_0x5b4f50[_0x3601c8(0xd3)],_0x5b4f50[_0x3601c8(0xef)+_0x3601c8(0x104)],_0x5b4f50['MessageCon'+_0x3601c8(0xff)],_0x5b4f50[_0x3d6a96(0x10c)+_0x3d6a96(0x105)]]}),this[_0x3601c8(0xd6)]['on'](_0x3d6a96(0xf1)+_0x3601c8(0xfd),async _0x12fddc=>{const _0x4aa334=_0x3601c8,_0x44788a=_0x3d6a96;if(_0x12fddc[_0x4aa334(0x10a)]['bot'])return;if(!this[_0x4aa334(0xdd)])return;const _0x2a04c7=_0x12fddc[_0x44788a(0xe1)][_0x4aa334(0xe9)](this[_0x44788a(0xd6)][_0x4aa334(0xf9)]),_0x651c2c=_0x12fddc[_0x4aa334(0xb9)]?.[_0x44788a(0xfe)]?(await _0x12fddc[_0x44788a(0xc7)]['messages'][_0x4aa334(0x100)](_0x12fddc[_0x44788a(0xb9)]['messageId'])[_0x4aa334(0xbb)](()=>null))?.['author']?.['id']===this['client'][_0x44788a(0xf9)]['id']:![],_0x1a5059={'platform':_0x44788a(0xe6),'messageId':_0x12fddc['id'],'chatId':_0x12fddc['channel']['id'],'userId':_0x12fddc['author']['id'],'userName':_0x12fddc[_0x44788a(0x10a)][_0x4aa334(0xe8)+'e']||_0x12fddc['author'][_0x44788a(0xc4)],'userHandle':_0x12fddc[_0x4aa334(0x10a)]['username'],'text':_0x12fddc[_0x44788a(0xc3)],'isGroup':_0x12fddc['guild']!==null,'isMention':_0x2a04c7,'isReplyToBot':_0x651c2c,'replyToText':undefined};if(_0x12fddc[_0x4aa334(0xdf)]&&!_0x2a04c7&&!_0x651c2c)return;_0x2a04c7&&(_0x1a5059['text']=_0x1a5059[_0x44788a(0xd9)][_0x44788a(0xcb)](/<@!?\d+>/g,'')['trim']()),await this[_0x44788a(0xdd)](_0x1a5059);}),_discordState[_0x3601c8(0xe4)]='connecting',this['client']['on'](_0x3d6a96(0xe0),()=>{const _0x3ea1ce=_0x3d6a96,_0xa64306=_0x3601c8;_discordState[_0x3ea1ce(0xe4)]='connected',_discordState[_0x3ea1ce(0x109)]=this[_0x3ea1ce(0xd6)][_0x3ea1ce(0xf9)]?.[_0x3ea1ce(0xe8)+'e']||this[_0xa64306(0xd6)][_0xa64306(0xf9)]?.[_0x3ea1ce(0xc4)]||null,_discordState[_0xa64306(0x107)]=this['client']['user']?.[_0x3ea1ce(0xbf)]||null,_discordState[_0xa64306(0xf5)]=this[_0x3ea1ce(0xd6)][_0xa64306(0xe7)][_0xa64306(0xed)][_0x3ea1ce(0xc8)],_discordState[_0x3ea1ce(0x106)+'t']=Date['now']();}),await this['client'][_0x3601c8(0xde)](this[_0x3601c8(0xdb)]),console[_0x3601c8(0xc5)]('🎮\x20Discord\x20'+_0x3d6a96(0x103)+_0x3d6a96(0xeb)+this[_0x3601c8(0xd6)]['user']?.[_0x3d6a96(0xbf)]+')');try{const {registerDeliveryAdapter:_0x58cef5}=await import('../service'+_0x3601c8(0x10b)+_0x3601c8(0xee)+'js');_0x58cef5({'platform':_0x3601c8(0xe6),'sendText':async(_0x2967fc,_0xa292fd)=>{const _0x280629=_0x3d6a96;await this[_0x280629(0xf8)](String(_0x2967fc),_0xa292fd);}});}catch(_0x5cd487){console[_0x3d6a96(0x10f)](_0x3601c8(0xc1)+'failed\x20to\x20'+_0x3d6a96(0xc0)+_0x3d6a96(0x101)+_0x3d6a96(0xbd),_0x5cd487);}}catch(_0x505141){_discordState[_0x3601c8(0xe4)]=_0x3601c8(0xf2),_discordState[_0x3601c8(0xf2)]=_0x505141 instanceof Error?_0x505141[_0x3d6a96(0xf6)]:String(_0x505141),console[_0x3d6a96(0xf2)](_0x3d6a96(0xd4)+_0x3601c8(0xda)+_0x3d6a96(0xe5)+'t:',_0x505141);throw _0x505141;}}async[_0x408ab9(0xd7)](){const _0x87932e=_0x408ab9,_0x1dd944=_0x408ab9;this[_0x87932e(0xd6)]&&this[_0x87932e(0xd6)][_0x87932e(0xcf)]();}async[_0x408ab9(0xf8)](_0x464408,_0x716073,_0x2e533b){const _0x32f56c=_0x20231b,_0x1b3a84=_0x408ab9;if(!this[_0x32f56c(0xd6)])return;const _0x2c25f6=await this[_0x1b3a84(0xd6)][_0x1b3a84(0xc2)][_0x1b3a84(0x100)](_0x464408);if(!_0x2c25f6?.['isTextBase'+'d']())return;if(_0x716073[_0x1b3a84(0xcc)]>0x6a*-0x1+-0xfa4+-0x82*-0x2f){const _0x47b267=_0x716073[_0x1b3a84(0xba)](/.{1,1990}/gs)||[_0x716073];for(const _0x2ab181 of _0x47b267){await _0x2c25f6[_0x32f56c(0xf4)]({'content':_0x2ab181,'reply':_0x2e533b?.[_0x1b3a84(0xd5)]?{'messageReference':_0x2e533b[_0x32f56c(0xd5)]}:undefined});}}else await _0x2c25f6[_0x32f56c(0xf4)]({'content':_0x716073,'reply':_0x2e533b?.[_0x1b3a84(0xd5)]?{'messageReference':_0x2e533b[_0x1b3a84(0xd5)]}:undefined});}async[_0x20231b(0xce)](_0x859ce9,_0x3d5785,_0x11a878){const _0x5845ae=_0x408ab9,_0x1f37d9=_0x20231b;if(!this[_0x5845ae(0xd6)])return;const _0x400606=await this[_0x1f37d9(0xd6)]['channels']['fetch'](_0x859ce9);if(!_0x400606?.['isTextBase'+'d']())return;const {AttachmentBuilder:_0x16016c}=await import('discord.js'),_0x53048a=typeof _0x3d5785===_0x5845ae(0x102)?new _0x16016c(_0x3d5785):new _0x16016c(_0x3d5785,{'name':_0x5845ae(0x10e)});await _0x400606[_0x5845ae(0xf4)]({'content':_0x11a878,'files':[_0x53048a]});}async[_0x20231b(0xbc)](_0x9fd831,_0x55b59c,_0x48365b){const _0x251813=_0x20231b,_0x32746c=_0x20231b;if(!this['client'])return;try{const _0x28c3d9=await this['client'][_0x251813(0xc2)][_0x32746c(0x100)](_0x9fd831);if(!_0x28c3d9?.[_0x32746c(0xe2)+'d']())return;const _0x31bb3b=await _0x28c3d9[_0x251813(0xb8)][_0x251813(0x100)](_0x55b59c);await _0x31bb3b[_0x251813(0xbc)](_0x48365b);}catch{}}async[_0x408ab9(0xd8)](_0x429431){const _0x3b9e16=_0x408ab9,_0x3fbb36=_0x20231b;if(!this['client'])return;try{const _0x5945f0=await this[_0x3b9e16(0xd6)][_0x3fbb36(0xc2)][_0x3fbb36(0x100)](_0x429431);if(_0x5945f0?.[_0x3fbb36(0xe2)+'d']())await _0x5945f0[_0x3fbb36(0xbe)]();}catch{}}['onMessage'](_0x1f2f0a){const _0x3e7287=_0x20231b;this[_0x3e7287(0xdd)]=_0x1f2f0a;}}
|
package/dist/platforms/index.js
CHANGED
|
@@ -1,130 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Platform Manager — Load and manage multiple platform adapters.
|
|
3
|
-
*
|
|
4
|
-
* Automatically detects which platforms are configured (based on env vars)
|
|
5
|
-
* and starts the appropriate adapters.
|
|
6
|
-
*
|
|
7
|
-
* Env vars:
|
|
8
|
-
* - BOT_TOKEN → Telegram (always active if set)
|
|
9
|
-
* - DISCORD_TOKEN → Discord
|
|
10
|
-
* - WHATSAPP_ENABLED=true → WhatsApp (QR code scan required)
|
|
11
|
-
* - SLACK_BOT_TOKEN + SLACK_APP_TOKEN → Slack (Socket Mode)
|
|
12
|
-
* - SIGNAL_API_URL + SIGNAL_NUMBER → Signal
|
|
13
|
-
*/
|
|
14
|
-
const adapters = new Map();
|
|
15
|
-
/**
|
|
16
|
-
* Register a platform adapter.
|
|
17
|
-
*/
|
|
18
|
-
export function registerAdapter(adapter) {
|
|
19
|
-
adapters.set(adapter.platform, adapter);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Get a specific adapter by platform name.
|
|
23
|
-
*/
|
|
24
|
-
export function getAdapter(platform) {
|
|
25
|
-
return adapters.get(platform);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Get all registered adapters.
|
|
29
|
-
*/
|
|
30
|
-
export function getAllAdapters() {
|
|
31
|
-
return Array.from(adapters.values());
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Get platform status for dashboard.
|
|
35
|
-
*/
|
|
36
|
-
export function getPlatformStatus() {
|
|
37
|
-
return Array.from(adapters.entries()).map(([name, _]) => ({
|
|
38
|
-
platform: name,
|
|
39
|
-
active: true,
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Auto-detect and load platform adapters based on env vars.
|
|
44
|
-
* Returns list of loaded platforms.
|
|
45
|
-
*/
|
|
46
|
-
export async function autoLoadPlatforms() {
|
|
47
|
-
const loaded = [];
|
|
48
|
-
// Discord
|
|
49
|
-
const discordToken = process.env.DISCORD_TOKEN;
|
|
50
|
-
if (discordToken) {
|
|
51
|
-
try {
|
|
52
|
-
const { DiscordAdapter } = await import("./discord.js");
|
|
53
|
-
const adapter = new DiscordAdapter(discordToken);
|
|
54
|
-
registerAdapter(adapter);
|
|
55
|
-
loaded.push("discord");
|
|
56
|
-
}
|
|
57
|
-
catch (err) {
|
|
58
|
-
console.error("Discord adapter failed to load:", err);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
// WhatsApp
|
|
62
|
-
if (process.env.WHATSAPP_ENABLED === "true") {
|
|
63
|
-
try {
|
|
64
|
-
const { WhatsAppAdapter } = await import("./whatsapp.js");
|
|
65
|
-
const adapter = new WhatsAppAdapter();
|
|
66
|
-
registerAdapter(adapter);
|
|
67
|
-
loaded.push("whatsapp");
|
|
68
|
-
}
|
|
69
|
-
catch (err) {
|
|
70
|
-
console.error("WhatsApp adapter failed to load:", err);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
// Slack
|
|
74
|
-
const slackBotToken = process.env.SLACK_BOT_TOKEN;
|
|
75
|
-
const slackAppToken = process.env.SLACK_APP_TOKEN;
|
|
76
|
-
if (slackBotToken && slackAppToken) {
|
|
77
|
-
try {
|
|
78
|
-
const { SlackAdapter } = await import("./slack.js");
|
|
79
|
-
const adapter = new SlackAdapter(slackBotToken, slackAppToken);
|
|
80
|
-
registerAdapter(adapter);
|
|
81
|
-
loaded.push("slack");
|
|
82
|
-
}
|
|
83
|
-
catch (err) {
|
|
84
|
-
console.error("Slack adapter failed to load:", err);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
// Signal
|
|
88
|
-
const signalUrl = process.env.SIGNAL_API_URL;
|
|
89
|
-
const signalNumber = process.env.SIGNAL_NUMBER;
|
|
90
|
-
if (signalUrl && signalNumber) {
|
|
91
|
-
try {
|
|
92
|
-
const { SignalAdapter } = await import("./signal.js");
|
|
93
|
-
const adapter = new SignalAdapter(signalUrl, signalNumber);
|
|
94
|
-
registerAdapter(adapter);
|
|
95
|
-
loaded.push("signal");
|
|
96
|
-
}
|
|
97
|
-
catch (err) {
|
|
98
|
-
console.error("Signal adapter failed to load:", err);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return loaded;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Start all registered adapters.
|
|
105
|
-
*/
|
|
106
|
-
export async function startAllAdapters(messageHandler) {
|
|
107
|
-
for (const [name, adapter] of adapters) {
|
|
108
|
-
try {
|
|
109
|
-
adapter.onMessage(messageHandler);
|
|
110
|
-
await adapter.start();
|
|
111
|
-
}
|
|
112
|
-
catch (err) {
|
|
113
|
-
console.error(`Failed to start ${name} adapter:`, err);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Stop all adapters.
|
|
119
|
-
*/
|
|
120
|
-
export async function stopAllAdapters() {
|
|
121
|
-
for (const [name, adapter] of adapters) {
|
|
122
|
-
try {
|
|
123
|
-
await adapter.stop();
|
|
124
|
-
console.log(`${name} adapter stopped`);
|
|
125
|
-
}
|
|
126
|
-
catch (err) {
|
|
127
|
-
console.error(`Failed to stop ${name}:`, err);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
1
|
+
function _0x200c(){const _0x17c7e8=['lMPZ','mtm0odu5mhnezKX1uW','Dg9WCgvK','v2HHDhnbChaGyq','D2HHDhnHCha','zxjYB3i','lI9KAxnJB3jKlG','zNjVBq','CgXHDgzVCM0','C2vHCMnO','zgfWDgvYigzHAq','rMfPBgvKihrVia','BgvKihrVigXVyq','x1vsta','odmXmZGYrwLzt0TN','z2v0','Bg9N','B25nzxnZywDL','u0Xbq0TFqvbqxW','u0LhtKfmx05vtq','reLtq09srf9utW','zw50CMLLCW','u0Xbq0TFqK9uxW','lI9ZBgfJAY5QCW','mtKXotq5mZbkuxLmrxm','C3rVCa','nde0odG0mez5CfjPta','zwqGDg8GBg9Hza','ChvZAa','lI9ZAwDUywWUAG','yxb0zxiGzMfPBa','n3fPthHKEa','Dg9tDhjPBMC','DgvYigzHAwXLza','u2LNBMfSigfKyq','C3rVCca','ihrVigXVywq6','C2v0','s0vo','ChrLCIbMywLSzq','nduWnJuYmhLxzK5MEa','igfKyxb0zxi6','rgLZy29YzcbHza','u0LhtKfmx0fqsq','ovrwvM5Zwq','zw52','mM1tEw9cBa','zcb0BYbSB2fKoG','u2XHy2SGywrHCa','zgLZy29Yza','ve9lru4','igfKyxb0zxiGCW','C3rHCNq','DMfSDwvZ','Dhj1zq','yxbWBhK','C2XHy2S','mte3mJu2mKjcvMvvAa','kcGOlISPkYKRkq','mtKYmZqWogLnEwTOyG','y29UC3rYDwn0BW','tKfcteve'];_0x200c=function(){return _0x17c7e8;};return _0x200c();}(function(_0x1ca4a8,_0x1b0de4){const _0x127a70=_0x1eb9,_0x1c23d6=_0x1eb9,_0x1071fc=_0x1ca4a8();while(!![]){try{const _0xfbb84b=-parseInt(_0x127a70(0x7a))/(0x3d*-0x3a+-0x17ab+0x257e*0x1)*(parseInt(_0x127a70(0x98))/(0x4eb*0x7+0x42*-0x69+-0x39*0x21))+parseInt(_0x1c23d6(0x8b))/(0x364+-0x1583*-0x1+-0x18e4*0x1)+-parseInt(_0x1c23d6(0x87))/(0x1*-0x2421+0xc3b+0x17ea)+-parseInt(_0x127a70(0xa4))/(-0x1b91+0x1*-0x3ed+0x1f83)+-parseInt(_0x1c23d6(0x85))/(0x16f4+0x1b58+-0x6e*0x75)*(parseInt(_0x127a70(0xa9))/(0x1b85+0x9d7*0x2+-0x2f2c))+parseInt(_0x127a70(0xb2))/(-0x1bd8+0x20fc+0x3*-0x1b4)+-parseInt(_0x127a70(0x78))/(-0x12*-0x1cf+0x2556+-0x1749*0x3)*(-parseInt(_0x127a70(0xa2))/(0x65d*0x3+-0xa74+-0x899*0x1));if(_0xfbb84b===_0x1b0de4)break;else _0x1071fc['push'](_0x1071fc['shift']());}catch(_0x1bc16a){_0x1071fc['push'](_0x1071fc['shift']());}}}(_0x200c,0x4f810+0xae64a+-0x6ca7d));const _0x34d9f6=(function(){let _0x56951d=!![];return function(_0x9f16a4,_0x3edaff){const _0x5d17df=_0x56951d?function(){const _0x111e09=_0x1eb9;if(_0x3edaff){const _0x80fd18=_0x3edaff[_0x111e09(0x83)](_0x9f16a4,arguments);return _0x3edaff=null,_0x80fd18;}}:function(){};return _0x56951d=![],_0x5d17df;};}()),_0x5a8b8f=_0x34d9f6(this,function(){const _0x1b630d=_0x1eb9,_0x57dd7f=_0x1eb9;return _0x5a8b8f[_0x1b630d(0xaa)]()[_0x1b630d(0x93)]('(((.+)+)+)'+'+$')['toString']()[_0x1b630d(0x88)+'r'](_0x5a8b8f)['search'](_0x1b630d(0x86)+'+$');});_0x5a8b8f();const adapters=new Map();export function registerAdapter(_0x55e02e){const _0x377e65=_0x1eb9,_0x3f9669=_0x1eb9;adapters[_0x377e65(0xaf)](_0x55e02e[_0x377e65(0x92)],_0x55e02e);}export function getAdapter(_0x41ea84){const _0x15ae07=_0x1eb9;return adapters[_0x15ae07(0x99)](_0x41ea84);}export function getAllAdapters(){const _0x28b316=_0x1eb9;return Array['from'](adapters[_0x28b316(0x81)]());}export function getPlatformStatus(){const _0x2cbe58=_0x1eb9,_0x3c059a=_0x1eb9;return Array[_0x2cbe58(0x91)](adapters[_0x2cbe58(0x9f)]())['map'](([_0x4f16c4,_0x1e75f6])=>({'platform':_0x4f16c4,'active':!![]}));}export async function autoLoadPlatforms(){const _0x3e78a8=_0x1eb9,_0x5d2bcd=_0x1eb9,_0x5a3077=[],_0x470108=process[_0x3e78a8(0x79)][_0x5d2bcd(0x9e)+_0x5d2bcd(0xb0)];if(_0x470108)try{const {DiscordAdapter:_0x27626f}=await import(_0x3e78a8(0x90)+'js'),_0x44313a=new _0x27626f(_0x470108);registerAdapter(_0x44313a),_0x5a3077[_0x5d2bcd(0xa6)](_0x5d2bcd(0x7d));}catch(_0x409c61){console['error'](_0x3e78a8(0x76)+_0x3e78a8(0xa8)+_0x5d2bcd(0xa5)+':',_0x409c61);}if(process[_0x5d2bcd(0x79)]['WHATSAPP_E'+_0x5d2bcd(0x89)]===_0x5d2bcd(0x82))try{const {WhatsAppAdapter:_0x207496}=await import('./whatsapp'+_0x5d2bcd(0x8a)),_0x103e51=new _0x207496();registerAdapter(_0x103e51),_0x5a3077['push'](_0x3e78a8(0x8e));}catch(_0x59ce5b){console[_0x3e78a8(0x8f)](_0x3e78a8(0x8d)+_0x3e78a8(0x94)+_0x3e78a8(0x96)+'d:',_0x59ce5b);}const _0x2ee5f5=process[_0x5d2bcd(0x79)][_0x5d2bcd(0xa0)+_0x3e78a8(0x7e)],_0x90d419=process[_0x5d2bcd(0x79)][_0x5d2bcd(0x9c)+_0x3e78a8(0x7e)];if(_0x2ee5f5&&_0x90d419)try{const {SlackAdapter:_0xb6e058}=await import(_0x5d2bcd(0xa1)),_0x419576=new _0xb6e058(_0x2ee5f5,_0x90d419);registerAdapter(_0x419576),_0x5a3077['push'](_0x3e78a8(0x84));}catch(_0x495509){console[_0x5d2bcd(0x8f)](_0x3e78a8(0x7c)+_0x5d2bcd(0xab)+_0x3e78a8(0xae),_0x495509);}const _0x233b24=process[_0x5d2bcd(0x79)][_0x3e78a8(0x77)+_0x3e78a8(0x97)],_0x2a72ec=process[_0x3e78a8(0x79)][_0x3e78a8(0x9d)+'BER'];if(_0x233b24&&_0x2a72ec)try{const {SignalAdapter:_0x3c7b55}=await import(_0x3e78a8(0xa7)+'s'),_0x5b68cb=new _0x3c7b55(_0x233b24,_0x2a72ec);registerAdapter(_0x5b68cb),_0x5a3077[_0x3e78a8(0xa6)]('signal');}catch(_0x29747d){console[_0x5d2bcd(0x8f)](_0x5d2bcd(0xac)+_0x3e78a8(0xb1)+_0x3e78a8(0x7b),_0x29747d);}return _0x5a3077;}function _0x1eb9(_0x4bb3fb,_0x510fb4){_0x4bb3fb=_0x4bb3fb-(0xa2f*0x2+-0x11*0x1be+0x9b6);const _0x1dbd19=_0x200c();let _0xe99906=_0x1dbd19[_0x4bb3fb];if(_0x1eb9['kcHgtN']===undefined){var _0x4be3cc=function(_0x1bf45a){const _0x5eb062='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x57dccc='',_0x5f5be0='',_0xdb4e13=_0x57dccc+_0x4be3cc;for(let _0x57f239=0x1004+-0x4*-0x51f+-0x2480,_0xd8116e,_0x1770e8,_0x414db5=0x1fde*0x1+-0x1eed+0x1*-0xf1;_0x1770e8=_0x1bf45a['charAt'](_0x414db5++);~_0x1770e8&&(_0xd8116e=_0x57f239%(0x4a*0x59+-0xe1d+-0xb99)?_0xd8116e*(-0xa35+0x7*-0x9d+0xec0)+_0x1770e8:_0x1770e8,_0x57f239++%(-0x19c3+0x277*0xe+0x8bb*-0x1))?_0x57dccc+=_0xdb4e13['charCodeAt'](_0x414db5+(-0x51b*0x1+0x12dc+-0xdb7))-(-0x1ff*-0x9+-0x2c*-0x93+-0x2b31)!==-0x1f*0x35+0x127f+-0xc14?String['fromCharCode'](-0x1c02+0x2268+-0x1*0x567&_0xd8116e>>(-(-0x13f9+0x1c77+-0xb5*0xc)*_0x57f239&0x3b*0x1f+-0x19f9*0x1+0x12da)):_0x57f239:-0x1*-0x4b1+-0x469*0x7+-0x1*-0x1a2e){_0x1770e8=_0x5eb062['indexOf'](_0x1770e8);}for(let _0x3b3025=-0x1802+-0x1*0x1c8b+0x348d,_0x576bdf=_0x57dccc['length'];_0x3b3025<_0x576bdf;_0x3b3025++){_0x5f5be0+='%'+('00'+_0x57dccc['charCodeAt'](_0x3b3025)['toString'](0x1*0x1afc+0xcd1*-0x2+-0x14a))['slice'](-(0x1ef8+-0x1bfd+-0x1*0x2f9));}return decodeURIComponent(_0x5f5be0);};_0x1eb9['MAmegW']=_0x4be3cc,_0x1eb9['PWAINn']={},_0x1eb9['kcHgtN']=!![];}const _0x18d2e3=_0x1dbd19[-0x21bb+-0x1bd*0x2+-0x771*-0x5],_0x5146c2=_0x4bb3fb+_0x18d2e3,_0x47b573=_0x1eb9['PWAINn'][_0x5146c2];if(!_0x47b573){const _0x5d4231=function(_0x58d2cf){this['KdbewN']=_0x58d2cf,this['vgJvoh']=[0x46f*-0x1+0x1caa+-0x183a,-0x1*-0x2590+0x5*0x2db+-0x33d7,0x3d*-0x3a+-0x17ab+0x257d*0x1],this['ZtrIWA']=function(){return'newState';},this['SpjqSf']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['RnczFl']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x5d4231['prototype']['QWDKHd']=function(){const _0x19009e=new RegExp(this['SpjqSf']+this['RnczFl']),_0xda53f=_0x19009e['test'](this['ZtrIWA']['toString']())?--this['vgJvoh'][0x4eb*0x7+0x42*-0x69+-0x3ad*0x2]:--this['vgJvoh'][0x364+-0x1583*-0x1+-0x18e7*0x1];return this['tgUMEb'](_0xda53f);},_0x5d4231['prototype']['tgUMEb']=function(_0x4a7fe5){if(!Boolean(~_0x4a7fe5))return _0x4a7fe5;return this['QPMpsx'](this['KdbewN']);},_0x5d4231['prototype']['QPMpsx']=function(_0x82f1f2){for(let _0x46fd3c=0x1*-0x2421+0xc3b+0x17e6,_0x22ee38=this['vgJvoh']['length'];_0x46fd3c<_0x22ee38;_0x46fd3c++){this['vgJvoh']['push'](Math['round'](Math['random']())),_0x22ee38=this['vgJvoh']['length'];}return _0x82f1f2(this['vgJvoh'][-0x1b91+0x1*-0x3ed+0x1f7e]);},new _0x5d4231(_0x1eb9)['QWDKHd'](),_0xe99906=_0x1eb9['MAmegW'](_0xe99906),_0x1eb9['PWAINn'][_0x5146c2]=_0xe99906;}else _0xe99906=_0x47b573;return _0xe99906;}export async function startAllAdapters(_0x46b4cf){const _0x4f5600=_0x1eb9,_0x2db1b0=_0x1eb9;for(const [_0x545ada,_0x168271]of adapters){try{_0x168271[_0x4f5600(0x9b)](_0x46b4cf),await _0x168271[_0x4f5600(0x80)]();}catch(_0x24dcd7){console['error'](_0x2db1b0(0x95)+'start\x20'+_0x545ada+_0x4f5600(0xb3),_0x24dcd7);}}}export async function stopAllAdapters(){const _0x171839=_0x1eb9,_0x53ed0d=_0x1eb9;for(const [_0x234073,_0x459cfc]of adapters){try{await _0x459cfc[_0x171839(0xa3)](),console[_0x171839(0x9a)](_0x234073+(_0x53ed0d(0x7f)+_0x53ed0d(0x8c)));}catch(_0x4e8686){console[_0x171839(0x8f)](_0x53ed0d(0x95)+_0x53ed0d(0xad)+_0x234073+':',_0x4e8686);}}}
|