alvin-bot 5.7.0 → 5.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.md +25 -31
- 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 -174
- 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 -583
- 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 -86
- 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 -1902
- package/dist/web/setup-api.js +1 -1101
- package/package.json +5 -2
- package/dist/.metadata_never_index +0 -0
|
@@ -1,109 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Console formatter — adds ISO timestamps to every console.log /
|
|
3
|
-
* console.warn / console.error call, and drops high-volume noise
|
|
4
|
-
* (libsignal session dumps, Claude CLI native-binary banner).
|
|
5
|
-
*
|
|
6
|
-
* Installed once at bootstrap time from src/index.ts. Idempotent.
|
|
7
|
-
*
|
|
8
|
-
* Why not pino / winston: those pull in several MB of deps and change
|
|
9
|
-
* the call-site ergonomics. Every caller in the bot today uses plain
|
|
10
|
-
* `console.log`; monkey-patching those is a 40-line change instead of
|
|
11
|
-
* a refactor of every file.
|
|
12
|
-
*/
|
|
13
|
-
import util from "node:util";
|
|
14
|
-
let snapshot = null;
|
|
15
|
-
/**
|
|
16
|
-
* Noise patterns from production logs that fill out.log/err.log with
|
|
17
|
-
* tens of KB per day without carrying useful signal. Added sparingly —
|
|
18
|
-
* every entry here is a line a human will never need to grep for.
|
|
19
|
-
*/
|
|
20
|
-
const NOISE_PATTERNS = [
|
|
21
|
-
// libsignal session dump header — the multi-line body following this
|
|
22
|
-
// line is silenced by the first-line detector below.
|
|
23
|
-
/^Closing session: SessionEntry \{/,
|
|
24
|
-
// libsignal prekey bundle swap notification
|
|
25
|
-
/^Closing open session in favor of incoming prekey bundle/,
|
|
26
|
-
// Claude CLI startup banner — spammed once per query
|
|
27
|
-
/^\[claude\] Native binary: /,
|
|
28
|
-
// libsignal Bad MAC — session desync, harmless, repeats endlessly
|
|
29
|
-
/^Session error:Error: Bad MAC Error: Bad MAC/,
|
|
30
|
-
];
|
|
31
|
-
/** Exported for testing. */
|
|
32
|
-
export function isNoisyLine(line) {
|
|
33
|
-
return NOISE_PATTERNS.some((re) => re.test(line));
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Track whether we're currently inside a libsignal multi-line dump. The
|
|
37
|
-
* dumps look like `Closing session: SessionEntry {` followed by several
|
|
38
|
-
* lines of buffer hex, closing with `}`. We swallow everything from the
|
|
39
|
-
* opening brace to its matching `}` line.
|
|
40
|
-
*/
|
|
41
|
-
let suppressDepth = 0;
|
|
42
|
-
function shouldSuppress(raw) {
|
|
43
|
-
const line = raw.trimEnd();
|
|
44
|
-
if (suppressDepth > 0) {
|
|
45
|
-
// Inside a multi-line dump — count braces on this line. The dumps
|
|
46
|
-
// only contain ASCII braces in the structural positions, so this
|
|
47
|
-
// is safe enough for production noise.
|
|
48
|
-
const opens = (line.match(/\{/g) || []).length;
|
|
49
|
-
const closes = (line.match(/\}/g) || []).length;
|
|
50
|
-
suppressDepth += opens;
|
|
51
|
-
suppressDepth -= closes;
|
|
52
|
-
if (suppressDepth < 0)
|
|
53
|
-
suppressDepth = 0;
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
if (isNoisyLine(line)) {
|
|
57
|
-
// If the noisy header opens a block, start suppressing its body.
|
|
58
|
-
const opens = (line.match(/\{/g) || []).length;
|
|
59
|
-
const closes = (line.match(/\}/g) || []).length;
|
|
60
|
-
suppressDepth = Math.max(0, opens - closes);
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
function formatWithTimestamp(method, stream) {
|
|
66
|
-
return (...args) => {
|
|
67
|
-
// Render args the same way console does — util.format handles %s / %d / objects.
|
|
68
|
-
const text = renderArgs(args);
|
|
69
|
-
if (shouldSuppress(text))
|
|
70
|
-
return;
|
|
71
|
-
const stamp = new Date().toISOString();
|
|
72
|
-
// Write directly to the stream so we don't recurse through console.
|
|
73
|
-
stream.write(`${stamp} ${text}\n`);
|
|
74
|
-
void method; // keep original ref alive for uninstall
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
function renderArgs(args) {
|
|
78
|
-
// Use Node's built-in util.format — it matches console.* exactly.
|
|
79
|
-
return util.format(...args);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Install timestamp + noise-filter formatters on console.log/warn/info/error.
|
|
83
|
-
* Safe to call multiple times.
|
|
84
|
-
*/
|
|
85
|
-
export function installConsoleFormatter() {
|
|
86
|
-
if (snapshot)
|
|
87
|
-
return; // already installed
|
|
88
|
-
snapshot = {
|
|
89
|
-
log: console.log.bind(console),
|
|
90
|
-
warn: console.warn.bind(console),
|
|
91
|
-
error: console.error.bind(console),
|
|
92
|
-
info: console.info.bind(console),
|
|
93
|
-
};
|
|
94
|
-
console.log = formatWithTimestamp(snapshot.log, process.stdout);
|
|
95
|
-
console.info = formatWithTimestamp(snapshot.info, process.stdout);
|
|
96
|
-
console.warn = formatWithTimestamp(snapshot.warn, process.stderr);
|
|
97
|
-
console.error = formatWithTimestamp(snapshot.error, process.stderr);
|
|
98
|
-
}
|
|
99
|
-
/** Restore the original console methods. Used by tests + shutdown. */
|
|
100
|
-
export function uninstallConsoleFormatter() {
|
|
101
|
-
if (!snapshot)
|
|
102
|
-
return;
|
|
103
|
-
console.log = snapshot.log;
|
|
104
|
-
console.info = snapshot.info;
|
|
105
|
-
console.warn = snapshot.warn;
|
|
106
|
-
console.error = snapshot.error;
|
|
107
|
-
snapshot = null;
|
|
108
|
-
suppressDepth = 0;
|
|
109
|
-
}
|
|
1
|
+
(function(_0x3e9db7,_0x22c8b0){const _0x5a2fd1=_0x2d0f,_0x2a57b0=_0x2d0f,_0x3e13b5=_0x3e9db7();while(!![]){try{const _0x4d7a59=-parseInt(_0x5a2fd1(0xe7))/(-0x19a4+0x26dc+-0x1*0xd37)*(-parseInt(_0x5a2fd1(0xf6))/(-0x1c1a+-0x432+0x204e))+-parseInt(_0x2a57b0(0x102))/(0x5*-0x243+0x22eb+-0x1799)+-parseInt(_0x2a57b0(0xec))/(0x935*0x2+0x815+-0x1*0x1a7b)*(-parseInt(_0x5a2fd1(0xf2))/(0xf07+-0xb*-0x66+-0x1364))+parseInt(_0x2a57b0(0x104))/(-0x71*-0x40+-0x6*-0x65+-0x1e98)+parseInt(_0x5a2fd1(0xf7))/(0xb8d*-0x3+-0x1b45+-0x1*-0x3df3)*(parseInt(_0x5a2fd1(0xfb))/(0x1ee8+-0x17af+-0x731))+-parseInt(_0x2a57b0(0xed))/(-0x18c4+0x9*-0x42d+0x2*0x1f31)*(-parseInt(_0x5a2fd1(0xe8))/(0x221f+0x189a+-0x3aaf))+-parseInt(_0x2a57b0(0x103))/(-0x579*-0x3+0x1fa2+-0x1801*0x2)*(parseInt(_0x5a2fd1(0xf0))/(-0x9e*0x8+-0x917+0xe13*0x1));if(_0x4d7a59===_0x22c8b0)break;else _0x3e13b5['push'](_0x3e13b5['shift']());}catch(_0x34da74){_0x3e13b5['push'](_0x3e13b5['shift']());}}}(_0x4c81,0x2*0x41ff0+0x5*0xcef9+-0x4b901));function _0x2d0f(_0x439448,_0x10654c){_0x439448=_0x439448-(0x160a*-0x1+0x1073*0x1+0x67d);const _0x5f1e68=_0x4c81();let _0x1c64b3=_0x5f1e68[_0x439448];if(_0x2d0f['qeYiia']===undefined){var _0x2c4614=function(_0x2a9151){const _0x19e42c='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x122b8a='',_0x2a59b8='',_0x21e284=_0x122b8a+_0x2c4614;for(let _0x5a4ec0=0x11f2+-0xe16+-0x3dc,_0x512722,_0x3e0cb3,_0x2adbdd=-0x1*-0x12e1+-0x1*-0x1344+-0x117*0x23;_0x3e0cb3=_0x2a9151['charAt'](_0x2adbdd++);~_0x3e0cb3&&(_0x512722=_0x5a4ec0%(0x252f*0x1+0xfb+-0x2626)?_0x512722*(0x425+-0x1*0x833+0x44e)+_0x3e0cb3:_0x3e0cb3,_0x5a4ec0++%(0xe5e+0x1*0x30f+-0x1169))?_0x122b8a+=_0x21e284['charCodeAt'](_0x2adbdd+(-0x1c40*-0x1+-0x1b37+-0xff))-(-0x626+-0x10b3+0x16e3)!==-0x1656*-0x1+-0x183*-0x2+0x195c*-0x1?String['fromCharCode'](0x32*-0x25+0x1*-0x23dd+0x2c16*0x1&_0x512722>>(-(-0x1df9*0x1+-0x176b+-0x1*-0x3566)*_0x5a4ec0&0x1f6*0x2+-0x12*-0x199+-0x20a8)):_0x5a4ec0:0x1f7e+0x377*-0x2+-0x189*0x10){_0x3e0cb3=_0x19e42c['indexOf'](_0x3e0cb3);}for(let _0x5adb64=-0x4d5*-0x5+0x7*-0x3b2+0x1b5,_0x4629aa=_0x122b8a['length'];_0x5adb64<_0x4629aa;_0x5adb64++){_0x2a59b8+='%'+('00'+_0x122b8a['charCodeAt'](_0x5adb64)['toString'](0xb10*-0x1+0x1*0xc86+-0x166))['slice'](-(-0x1544+0x1*0x481+-0x9f*-0x1b));}return decodeURIComponent(_0x2a59b8);};_0x2d0f['WzLgyo']=_0x2c4614,_0x2d0f['mvGqlT']={},_0x2d0f['qeYiia']=!![];}const _0x4d625f=_0x5f1e68[0xb*-0x1ab+-0x1978*0x1+0x2bd1],_0x2e2265=_0x439448+_0x4d625f,_0xd63418=_0x2d0f['mvGqlT'][_0x2e2265];if(!_0xd63418){const _0x398e19=function(_0x500938){this['ZgWObQ']=_0x500938,this['AMMbwG']=[0x8e*0x44+-0x1*-0xa2a+-0x2fe1,-0x5*-0x5cf+0x3*-0x94d+-0x124,0x2316+-0x1890+-0xa86],this['dpTeOv']=function(){return'newState';},this['MiHICc']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['qQugkI']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x398e19['prototype']['rARtGN']=function(){const _0x49eb3f=new RegExp(this['MiHICc']+this['qQugkI']),_0x13b4e2=_0x49eb3f['test'](this['dpTeOv']['toString']())?--this['AMMbwG'][-0x257c+0x12fc+-0x1281*-0x1]:--this['AMMbwG'][0x480*-0x1+-0x84*0x43+0x24c*0x11];return this['lNfQOy'](_0x13b4e2);},_0x398e19['prototype']['lNfQOy']=function(_0x5b0d47){if(!Boolean(~_0x5b0d47))return _0x5b0d47;return this['sKkHkd'](this['ZgWObQ']);},_0x398e19['prototype']['sKkHkd']=function(_0x1afaf4){for(let _0x420801=-0xc1c+-0x193f+0x83*0x49,_0x3509bf=this['AMMbwG']['length'];_0x420801<_0x3509bf;_0x420801++){this['AMMbwG']['push'](Math['round'](Math['random']())),_0x3509bf=this['AMMbwG']['length'];}return _0x1afaf4(this['AMMbwG'][-0x1865+-0x1*0x136d+0x2bd2]);},new _0x398e19(_0x2d0f)['rARtGN'](),_0x1c64b3=_0x2d0f['WzLgyo'](_0x1c64b3),_0x2d0f['mvGqlT'][_0x2e2265]=_0x1c64b3;}else _0x1c64b3=_0xd63418;return _0x1c64b3;}const _0x3fef98=(function(){let _0x33610b=!![];return function(_0x529e25,_0x3c92bb){const _0x4675bc=_0x33610b?function(){const _0x3b3de8=_0x2d0f;if(_0x3c92bb){const _0x7689ab=_0x3c92bb[_0x3b3de8(0xe6)](_0x529e25,arguments);return _0x3c92bb=null,_0x7689ab;}}:function(){};return _0x33610b=![],_0x4675bc;};}()),_0x5cf9dc=_0x3fef98(this,function(){const _0x31c3d9=_0x2d0f,_0xab1214=_0x2d0f;return _0x5cf9dc[_0x31c3d9(0xf3)]()[_0xab1214(0xf5)](_0xab1214(0xee)+'+$')[_0xab1214(0xf3)]()[_0x31c3d9(0xff)+'r'](_0x5cf9dc)[_0x31c3d9(0xf5)](_0x31c3d9(0xee)+'+$');});_0x5cf9dc();import _0x4af356 from'node:util';let snapshot=null;const NOISE_PATTERNS=[/^Closing session: SessionEntry \{/,/^Closing open session in favor of incoming prekey bundle/,/^\[claude\] Native binary: /,/^Session error:Error: Bad MAC Error: Bad MAC/];function _0x4c81(){const _0x46fb65=['mLnPrerSCW','ntCWwK9TrvvY','Bwf0y2G','Bg9N','D3jPDgu','ngPUAKDjua','mtiZotu3Ae9LEgrp','kcGOlISPkYKRkq','D2fYBG','odrUAfn1z0S','C3rKzxjY','ndK4mJy1yM5Ar05q','Dg9tDhjPBMC','DhjPBuvUza','C2vHCMnO','nJa3mZrjt1PtqNe','mJi4mJu4mw9hr3nyAG','BgvUz3rO','Aw5MBW','zxjYB3i','og10BMjnAW','DgvZDa','Bwf4','Dg9ju09tDhjPBG','y29UC3rYDwn0BW','C29Tzq','yMLUza','mJqXntCYBen1wu1h','mJiZotC1ngPSB0nsAG','ndm4mJeWnKP5C1rOqq','yxbWBhK'];_0x4c81=function(){return _0x46fb65;};return _0x4c81();}export function isNoisyLine(_0x5f4a3a){const _0x3fc64d=_0x2d0f,_0x3384a1=_0x2d0f;return NOISE_PATTERNS[_0x3fc64d(0x100)](_0x5dbc6e=>_0x5dbc6e[_0x3fc64d(0xfc)](_0x5f4a3a));}let suppressDepth=0x1344+-0x1*-0x16d5+-0x33d*0xd;function shouldSuppress(_0x26de0d){const _0x4a988f=_0x2d0f,_0xcd0594=_0x2d0f,_0x3eafe7=_0x26de0d[_0x4a988f(0xf4)]();if(suppressDepth>0x252f*0x1+0xfb+-0x262a){const _0x381e43=(_0x3eafe7[_0x4a988f(0xe9)](/\{/g)||[])[_0x4a988f(0xf8)],_0x4a5c86=(_0x3eafe7[_0x4a988f(0xe9)](/\}/g)||[])['length'];suppressDepth+=_0x381e43,suppressDepth-=_0x4a5c86;if(suppressDepth<0x425+-0x1*0x833+0x40e)suppressDepth=0xe5e+0x1*0x30f+-0x116d;return!![];}if(isNoisyLine(_0x3eafe7)){const _0x45bb5d=(_0x3eafe7[_0xcd0594(0xe9)](/\{/g)||[])[_0xcd0594(0xf8)],_0x2fc3d6=(_0x3eafe7[_0xcd0594(0xe9)](/\}/g)||[])[_0xcd0594(0xf8)];return suppressDepth=Math[_0xcd0594(0xfd)](-0x1c40*-0x1+-0x1b37+-0x109,_0x45bb5d-_0x2fc3d6),!![];}return![];}function formatWithTimestamp(_0x5757e1,_0x5f0949){return(..._0xb1b851)=>{const _0x28254a=_0x2d0f,_0x5b55bb=_0x2d0f,_0x131afd=renderArgs(_0xb1b851);if(shouldSuppress(_0x131afd))return;const _0x5cca26=new Date()[_0x28254a(0xfe)+'g']();_0x5f0949[_0x5b55bb(0xeb)](_0x5cca26+'\x20'+_0x131afd+'\x0a'),void _0x5757e1;};}function renderArgs(_0xceb4ba){return _0x4af356['format'](..._0xceb4ba);}export function installConsoleFormatter(){const _0x4858ed=_0x2d0f,_0x20a9c4=_0x2d0f;if(snapshot)return;snapshot={'log':console['log'][_0x4858ed(0x101)](console),'warn':console[_0x20a9c4(0xef)][_0x20a9c4(0x101)](console),'error':console[_0x20a9c4(0xfa)][_0x20a9c4(0x101)](console),'info':console['info'][_0x20a9c4(0x101)](console)},console['log']=formatWithTimestamp(snapshot[_0x4858ed(0xea)],process['stdout']),console[_0x20a9c4(0xf9)]=formatWithTimestamp(snapshot[_0x4858ed(0xf9)],process['stdout']),console[_0x4858ed(0xef)]=formatWithTimestamp(snapshot[_0x20a9c4(0xef)],process[_0x20a9c4(0xf1)]),console[_0x20a9c4(0xfa)]=formatWithTimestamp(snapshot[_0x20a9c4(0xfa)],process['stderr']);}export function uninstallConsoleFormatter(){const _0x25db53=_0x2d0f,_0x5b8ab7=_0x2d0f;if(!snapshot)return;console['log']=snapshot[_0x25db53(0xea)],console[_0x25db53(0xf9)]=snapshot[_0x5b8ab7(0xf9)],console[_0x5b8ab7(0xef)]=snapshot[_0x5b8ab7(0xef)],console[_0x5b8ab7(0xfa)]=snapshot[_0x25db53(0xfa)],snapshot=null,suppressDepth=-0x626+-0x10b3+0x16d9;}
|
package/dist/util/debounce.js
CHANGED
|
@@ -1,24 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Trailing-edge debounce. Delays `fn` until `waitMs` has elapsed since
|
|
3
|
-
* the most recent call. Coalesces bursts into a single invocation with
|
|
4
|
-
* the most recent arguments.
|
|
5
|
-
*
|
|
6
|
-
* Used by fs.watch consumers (skills, plugins) where macOS FSEvents
|
|
7
|
-
* delivers many duplicate events for a single logical change.
|
|
8
|
-
*/
|
|
9
|
-
export function debounce(fn, waitMs) {
|
|
10
|
-
let timer = null;
|
|
11
|
-
let lastArgs = null;
|
|
12
|
-
return function debounced(...args) {
|
|
13
|
-
lastArgs = args;
|
|
14
|
-
if (timer)
|
|
15
|
-
clearTimeout(timer);
|
|
16
|
-
timer = setTimeout(() => {
|
|
17
|
-
timer = null;
|
|
18
|
-
const call = lastArgs;
|
|
19
|
-
lastArgs = null;
|
|
20
|
-
if (call)
|
|
21
|
-
fn(...call);
|
|
22
|
-
}, waitMs);
|
|
23
|
-
};
|
|
24
|
-
}
|
|
1
|
+
(function(_0x4d9573,_0xf24424){const _0x53b844=_0x34d4,_0x4c5eec=_0x34d4,_0x53a696=_0x4d9573();while(!![]){try{const _0x6d38a2=parseInt(_0x53b844(0x7b))/(-0x265e+-0x76*0x47+0x4719)*(-parseInt(_0x4c5eec(0x7f))/(-0x1cb7+0x3*0x9cf+-0x2*0x5a))+-parseInt(_0x53b844(0x7a))/(-0xc22+-0x1dab*0x1+-0x14e8*-0x2)+parseInt(_0x4c5eec(0x84))/(0x11*-0x209+-0x130a+0x35a7)*(-parseInt(_0x53b844(0x83))/(-0x1*0x19ab+0x4b2+0x14fe))+-parseInt(_0x4c5eec(0x85))/(0x2040+-0x9*0x301+-0x531)+parseInt(_0x4c5eec(0x86))/(-0x7*-0x493+-0x23e5+0x3e7)*(parseInt(_0x4c5eec(0x87))/(-0x3*-0xca9+0x16b6+0x125*-0x35))+-parseInt(_0x4c5eec(0x79))/(-0x16e6+0x35*0x6a+0xb*0x17)*(-parseInt(_0x53b844(0x80))/(0x4*0x842+-0x24fa+-0xf*-0x44))+-parseInt(_0x53b844(0x7e))/(0x1bb8+-0xbdb+-0xfd2)*(-parseInt(_0x53b844(0x82))/(-0x2160+0x1750+-0x2*-0x50e));if(_0x6d38a2===_0xf24424)break;else _0x53a696['push'](_0x53a696['shift']());}catch(_0x45f960){_0x53a696['push'](_0x53a696['shift']());}}}(_0xb08e,0xeff96+-0x5*-0x41d49+-0x16ebf2));function _0x34d4(_0x56c53b,_0x3e0a83){_0x56c53b=_0x56c53b-(0x1603+-0x1a2f+0x4a4);const _0x301653=_0xb08e();let _0x21e1c5=_0x301653[_0x56c53b];if(_0x34d4['ibpPKl']===undefined){var _0x59ed37=function(_0x5ac248){const _0x259107='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0xed65d9='',_0x5d3c89='',_0x520810=_0xed65d9+_0x59ed37;for(let _0x13bd40=-0x1e08*0x1+0x437+-0x19d1*-0x1,_0x4a78bf,_0xdafd5e,_0x5c33d1=0x1ca1+0x760*-0x1+-0x1541;_0xdafd5e=_0x5ac248['charAt'](_0x5c33d1++);~_0xdafd5e&&(_0x4a78bf=_0x13bd40%(-0x16e8+0x21*0xef+0x7e3*-0x1)?_0x4a78bf*(0x1837+-0x2301+0xb0a)+_0xdafd5e:_0xdafd5e,_0x13bd40++%(0x4*0x33d+0x1636+0x199*-0x16))?_0xed65d9+=_0x520810['charCodeAt'](_0x5c33d1+(0x11d4*-0x1+0x91e+-0xe*-0xa0))-(-0x1*-0x1115+-0x1a03*0x1+0x8f8)!==0xc85*0x3+-0xc08+-0x1987?String['fromCharCode'](0x54e*-0x3+0x15dd+0x27a*-0x2&_0x4a78bf>>(-(0x1f*0x6b+0x10ed+0x778*-0x4)*_0x13bd40&0x748+0x253c+-0x5*0x8e6)):_0x13bd40:-0xa7b*-0x1+0x10c1*-0x1+-0x323*-0x2){_0xdafd5e=_0x259107['indexOf'](_0xdafd5e);}for(let _0x425da7=0x158a+-0x2654+0x10ca*0x1,_0x58e8c5=_0xed65d9['length'];_0x425da7<_0x58e8c5;_0x425da7++){_0x5d3c89+='%'+('00'+_0xed65d9['charCodeAt'](_0x425da7)['toString'](-0xe1c+0x1*-0x1e27+0x2c53*0x1))['slice'](-(-0x660+-0x96d*-0x1+-0x29*0x13));}return decodeURIComponent(_0x5d3c89);};_0x34d4['FIZUMg']=_0x59ed37,_0x34d4['sClKAx']={},_0x34d4['ibpPKl']=!![];}const _0xa06b6a=_0x301653[0x2322+-0x4fd*-0x2+-0x168e*0x2],_0x5e0bad=_0x56c53b+_0xa06b6a,_0x4b680f=_0x34d4['sClKAx'][_0x5e0bad];if(!_0x4b680f){const _0x477ab5=function(_0x580097){this['vLPPLO']=_0x580097,this['JJUlnC']=[0xfc3+-0x1bb9*-0x1+-0x2b7b,-0x525+0x10fa+-0xbd5,0x3*0x9cf+-0x2*0xe14+-0x145],this['srKjWO']=function(){return'newState';},this['abEokO']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['wlOTfF']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x477ab5['prototype']['XdTpnO']=function(){const _0x28ebdf=new RegExp(this['abEokO']+this['wlOTfF']),_0x540c0d=_0x28ebdf['test'](this['srKjWO']['toString']())?--this['JJUlnC'][-0x1dab*0x1+-0x2b4*0x1+0x2060]:--this['JJUlnC'][-0x1*0x130a+0xd4+0x1236];return this['KjuFrC'](_0x540c0d);},_0x477ab5['prototype']['KjuFrC']=function(_0x35ecf0){if(!Boolean(~_0x35ecf0))return _0x35ecf0;return this['McAuix'](this['vLPPLO']);},_0x477ab5['prototype']['McAuix']=function(_0xc8a4c1){for(let _0x53c7a5=0x4b2+0x167c+-0x1b2e,_0x1dffaf=this['JJUlnC']['length'];_0x53c7a5<_0x1dffaf;_0x53c7a5++){this['JJUlnC']['push'](Math['round'](Math['random']())),_0x1dffaf=this['JJUlnC']['length'];}return _0xc8a4c1(this['JJUlnC'][0x2040+-0x9*0x301+-0x537]);},new _0x477ab5(_0x34d4)['XdTpnO'](),_0x21e1c5=_0x34d4['FIZUMg'](_0x21e1c5),_0x34d4['sClKAx'][_0x5e0bad]=_0x21e1c5;}else _0x21e1c5=_0x4b680f;return _0x21e1c5;}function _0xb08e(){const _0x5e5b55=['mtm5mJG2ofrtsuXota','mJyXmZe5ohzwDKDVvW','mJK1oty3Aeruugvp','mta0yw1Ju1HX','Dg9tDhjPBMC','odq4ndiXzMPzqvbu','ndyWmdqWnhnWt05xDa','ndu1tgLyB0jN','y29UC3rYDwn0BW','C2vHCMnO','mJeWmwHyr21jAW','nJuZmgDzCKTxza','mtaWDKDKqwrq','kcGOlISPkYKRkq','mJyYodCYv2zlu3Hb','mJbYtvvfwwK'];_0xb08e=function(){return _0x5e5b55;};return _0xb08e();}const _0xcc1eb2=(function(){let _0x26afad=!![];return function(_0x105d1b,_0x340077){const _0x5c4156=_0x26afad?function(){if(_0x340077){const _0x91837b=_0x340077['apply'](_0x105d1b,arguments);return _0x340077=null,_0x91837b;}}:function(){};return _0x26afad=![],_0x5c4156;};}()),_0x5eae87=_0xcc1eb2(this,function(){const _0x5848ba=_0x34d4,_0x5dad61=_0x34d4;return _0x5eae87['toString']()[_0x5848ba(0x7d)](_0x5848ba(0x81)+'+$')[_0x5dad61(0x78)]()[_0x5848ba(0x7c)+'r'](_0x5eae87)[_0x5dad61(0x7d)](_0x5848ba(0x81)+'+$');});_0x5eae87();export function debounce(_0x13bb82,_0x5549eb){let _0x80381a=null,_0x381421=null;return function _0x41b1e6(..._0x55db40){_0x381421=_0x55db40;if(_0x80381a)clearTimeout(_0x80381a);_0x80381a=setTimeout(()=>{_0x80381a=null;const _0x5afc4b=_0x381421;_0x381421=null;if(_0x5afc4b)_0x13bb82(..._0x5afc4b);},_0x5549eb);};}
|
|
@@ -1,62 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Telegram error filter — single source of truth for "which grammy
|
|
3
|
-
* errors are harmless and should never reach the end user as a
|
|
4
|
-
* 'Fehler: ...' reply."
|
|
5
|
-
*
|
|
6
|
-
* Context: grammy's Bot API wrapper surfaces these as plain Error
|
|
7
|
-
* objects with the description baked into `.message`. Some call sites
|
|
8
|
-
* (live-stream edit races, callback-answer races after a modal was
|
|
9
|
-
* already dismissed, message-to-edit-gone races when the user just
|
|
10
|
-
* deleted the message) produce errors that are 100% benign — they
|
|
11
|
-
* just mean the UI state we were about to write is already there.
|
|
12
|
-
*
|
|
13
|
-
* This file centralises the list so we can update one regex and have
|
|
14
|
-
* the filter apply everywhere. Used by bot.catch(), by the streaming
|
|
15
|
-
* `telegram.ts` finalize path, by handlers/message.ts, and by any
|
|
16
|
-
* future caller that needs to decide "report this to the user or
|
|
17
|
-
* drop it silently."
|
|
18
|
-
*/
|
|
19
|
-
const HARMLESS_PATTERNS = [
|
|
20
|
-
// The big one — live-stream edit races
|
|
21
|
-
/message is not modified/i,
|
|
22
|
-
/specified new message content and reply markup are exactly the same/i,
|
|
23
|
-
// Callback-answer race: the user tapped a stale inline button
|
|
24
|
-
/query is too old and response timeout expired/i,
|
|
25
|
-
/query ID is invalid/i,
|
|
26
|
-
// The user deleted the message we were about to edit
|
|
27
|
-
/message to edit not found/i,
|
|
28
|
-
/message to delete not found/i,
|
|
29
|
-
/MESSAGE_ID_INVALID/i,
|
|
30
|
-
];
|
|
31
|
-
/**
|
|
32
|
-
* True if the error is one of the known-harmless Telegram races.
|
|
33
|
-
* Accepts Error objects, grammy's GrammyError (which has an additional
|
|
34
|
-
* `description` field), and plain strings. `null` / `undefined` return
|
|
35
|
-
* false so callers can use this directly in catch blocks.
|
|
36
|
-
*/
|
|
37
|
-
export function isHarmlessTelegramError(err) {
|
|
38
|
-
if (err === null || err === undefined)
|
|
39
|
-
return false;
|
|
40
|
-
let haystack = "";
|
|
41
|
-
if (typeof err === "string") {
|
|
42
|
-
haystack = err;
|
|
43
|
-
}
|
|
44
|
-
else if (err instanceof Error) {
|
|
45
|
-
haystack = err.message || "";
|
|
46
|
-
// grammy's GrammyError carries the server's reason on .description
|
|
47
|
-
const desc = err.description;
|
|
48
|
-
if (typeof desc === "string")
|
|
49
|
-
haystack += " " + desc;
|
|
50
|
-
}
|
|
51
|
-
else if (typeof err === "object") {
|
|
52
|
-
// Plain object — look for message/description fields
|
|
53
|
-
const obj = err;
|
|
54
|
-
if (typeof obj.message === "string")
|
|
55
|
-
haystack += obj.message;
|
|
56
|
-
if (typeof obj.description === "string")
|
|
57
|
-
haystack += " " + obj.description;
|
|
58
|
-
}
|
|
59
|
-
if (!haystack)
|
|
60
|
-
return false;
|
|
61
|
-
return HARMLESS_PATTERNS.some((re) => re.test(haystack));
|
|
62
|
-
}
|
|
1
|
+
function _0x2718(_0x5973ec,_0x47be8d){_0x5973ec=_0x5973ec-(0x74*-0x27+-0xe5f+-0x3*-0xb17);const _0x33ef27=_0x4d4b();let _0x27290b=_0x33ef27[_0x5973ec];if(_0x2718['DZekov']===undefined){var _0x276eff=function(_0x1b0648){const _0xf85cb0='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x5daa0d='',_0xa5a4db='',_0x1cab01=_0x5daa0d+_0x276eff;for(let _0x4b6ec3=-0x2*0xeb0+-0x1*-0x20ae+-0x34e,_0x50ae2f,_0x1441d6,_0x264f90=-0x26ef+-0x10fa+-0x27*-0x16f;_0x1441d6=_0x1b0648['charAt'](_0x264f90++);~_0x1441d6&&(_0x50ae2f=_0x4b6ec3%(-0x2326+-0x837+0x2b61)?_0x50ae2f*(-0x2d7*-0xd+0x1*-0x8eb+-0x3*0x940)+_0x1441d6:_0x1441d6,_0x4b6ec3++%(-0x423*-0x1+0x8db+-0x97*0x16))?_0x5daa0d+=_0x1cab01['charCodeAt'](_0x264f90+(0x2676+0xe3b*0x1+-0x34a7))-(-0x2003+0x18ea+-0x7*-0x105)!==-0x6*0xd5+-0x1d12+-0x4*-0x884?String['fromCharCode'](-0x13bf*-0x1+0x1c*-0xe5+0x64c&_0x50ae2f>>(-(-0x259a+0x19cd*0x1+0x1*0xbcf)*_0x4b6ec3&-0x12ae+0x73f+0xb75)):_0x4b6ec3:-0x33*-0x5d+-0xf25+-0x362){_0x1441d6=_0xf85cb0['indexOf'](_0x1441d6);}for(let _0x1a67a5=-0x2359*-0x1+0x9db*0x2+-0x370f,_0x4e7375=_0x5daa0d['length'];_0x1a67a5<_0x4e7375;_0x1a67a5++){_0xa5a4db+='%'+('00'+_0x5daa0d['charCodeAt'](_0x1a67a5)['toString'](-0x109*0x14+-0x9e1+0x1ea5))['slice'](-(0x3*0xa7f+-0xc07+-0x1374));}return decodeURIComponent(_0xa5a4db);};_0x2718['vsmoer']=_0x276eff,_0x2718['CvRuld']={},_0x2718['DZekov']=!![];}const _0x3d8446=_0x33ef27[0xc38+0x175f+-0x1*0x2397],_0x3ed99a=_0x5973ec+_0x3d8446,_0x537319=_0x2718['CvRuld'][_0x3ed99a];if(!_0x537319){const _0x216141=function(_0x15bdba){this['SISvOk']=_0x15bdba,this['RWfnaL']=[0x236b+0x45e+-0x218*0x13,0xb71+0xb82+-0x16f3,0xdc6+-0x1388+0x5c2],this['uNmDiV']=function(){return'newState';},this['TExeFu']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['LxhThU']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x216141['prototype']['KDKtRY']=function(){const _0x3f6756=new RegExp(this['TExeFu']+this['LxhThU']),_0x105eaa=_0x3f6756['test'](this['uNmDiV']['toString']())?--this['RWfnaL'][-0xe47+0x149e+-0x656]:--this['RWfnaL'][0x20b*-0x11+0x3*-0xc56+0x47bd];return this['uAAGim'](_0x105eaa);},_0x216141['prototype']['uAAGim']=function(_0x266594){if(!Boolean(~_0x266594))return _0x266594;return this['RKdLZo'](this['SISvOk']);},_0x216141['prototype']['RKdLZo']=function(_0x482679){for(let _0x18acb7=-0x53*-0x2c+-0xcc7+-0x17d,_0x54fd6d=this['RWfnaL']['length'];_0x18acb7<_0x54fd6d;_0x18acb7++){this['RWfnaL']['push'](Math['round'](Math['random']())),_0x54fd6d=this['RWfnaL']['length'];}return _0x482679(this['RWfnaL'][-0x6c5*-0x4+0x41*0x11+-0x37d*0x9]);},new _0x216141(_0x2718)['KDKtRY'](),_0x27290b=_0x2718['vsmoer'](_0x27290b),_0x2718['CvRuld'][_0x3ed99a]=_0x27290b;}else _0x27290b=_0x537319;return _0x27290b;}function _0x4d4b(){const _0x26ec82=['n01Wq25PEq','nteWodvHuMXgwu8','C3rYAw5N','mtaYndH4wen2yuO','mZzQv2jotxC','zgvZy3jPChrPBW','DgvZDa','yxbWBhK','mtK0mtCZnLHoqMfwvW','kcGOlISPkYKRkq','BwvZC2fNzq','Dg9tDhjPBMC','C2vHCMnO','nteWCLvYu0DI','mta0mteYnKPUrwv4Cq','ndG5mtbREfz0D2C','B2jQzwn0','n2rsvMDLuq','mte0mtG2ovHZCfP3tG','mZKYmJjYBxrcAgC','odKXB0LqEgfd'];_0x4d4b=function(){return _0x26ec82;};return _0x4d4b();}(function(_0x32aeec,_0x155147){const _0xb5fd5e=_0x2718,_0x403b1e=_0x2718,_0x4ec3a8=_0x32aeec();while(!![]){try{const _0x59b792=parseInt(_0xb5fd5e(0x14c))/(-0x1ae3*0x1+0xb71+0xf73)*(-parseInt(_0x403b1e(0x14a))/(0xdc6+-0x1388+0x5c4))+parseInt(_0x403b1e(0x14d))/(-0xe47+0x149e+-0x654)+parseInt(_0x403b1e(0x13f))/(0x20b*-0x11+0x3*-0xc56+0x47c1)*(-parseInt(_0x403b1e(0x13c))/(-0x53*-0x2c+-0xcc7+-0x178))+-parseInt(_0xb5fd5e(0x149))/(-0x6c5*-0x4+0x41*0x11+-0x1f5f*0x1)*(-parseInt(_0xb5fd5e(0x13b))/(-0x6*-0x5b4+0x13b6+0x1*-0x35e7))+-parseInt(_0x403b1e(0x143))/(0x1d4d+-0x877*0x2+-0xc57)+-parseInt(_0x403b1e(0x14e))/(0x16bb+0x1b08+-0x31ba)*(-parseInt(_0x403b1e(0x148))/(0x1934+-0xbb9*0x1+-0xd71))+parseInt(_0x403b1e(0x13a))/(-0x2dd*-0x7+-0x12db+-0x125)*(-parseInt(_0xb5fd5e(0x13e))/(-0xba1*0x3+0x5b7+0x1d38));if(_0x59b792===_0x155147)break;else _0x4ec3a8['push'](_0x4ec3a8['shift']());}catch(_0x405dc7){_0x4ec3a8['push'](_0x4ec3a8['shift']());}}}(_0x4d4b,-0x223*0x2a5+0x23887+0x680a5));const _0x94caec=(function(){let _0x618482=!![];return function(_0x2bd90,_0x1af810){const _0x48e68b=_0x618482?function(){const _0x541ad2=_0x2718;if(_0x1af810){const _0x2a1eac=_0x1af810[_0x541ad2(0x142)](_0x2bd90,arguments);return _0x1af810=null,_0x2a1eac;}}:function(){};return _0x618482=![],_0x48e68b;};}()),_0x4cd952=_0x94caec(this,function(){const _0x293f00=_0x2718,_0x56a5f7=_0x2718;return _0x4cd952[_0x293f00(0x146)]()[_0x293f00(0x147)](_0x293f00(0x144)+'+$')[_0x56a5f7(0x146)]()['constructo'+'r'](_0x4cd952)['search']('(((.+)+)+)'+'+$');});_0x4cd952();const HARMLESS_PATTERNS=[/message is not modified/i,/specified new message content and reply markup are exactly the same/i,/query is too old and response timeout expired/i,/query ID is invalid/i,/message to edit not found/i,/message to delete not found/i,/MESSAGE_ID_INVALID/i];export function isHarmlessTelegramError(_0x424921){const _0x598ecb=_0x2718,_0x3fabca=_0x2718;if(_0x424921===null||_0x424921===undefined)return![];let _0x1d5538='';if(typeof _0x424921==='string')_0x1d5538=_0x424921;else{if(_0x424921 instanceof Error){_0x1d5538=_0x424921['message']||'';const _0x4c9cdd=_0x424921['descriptio'+'n'];if(typeof _0x4c9cdd==='string')_0x1d5538+='\x20'+_0x4c9cdd;}else{if(typeof _0x424921===_0x598ecb(0x14b)){const _0x25aa17=_0x424921;if(typeof _0x25aa17[_0x598ecb(0x145)]==='string')_0x1d5538+=_0x25aa17[_0x598ecb(0x145)];if(typeof _0x25aa17['descriptio'+'n']===_0x598ecb(0x13d))_0x1d5538+='\x20'+_0x25aa17[_0x3fabca(0x140)+'n'];}}}if(!_0x1d5538)return![];return HARMLESS_PATTERNS['some'](_0x17bdef=>_0x17bdef[_0x598ecb(0x141)](_0x1d5538));}
|
package/dist/version.js
CHANGED
|
@@ -1,24 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Central source of truth for the running Alvin Bot version.
|
|
3
|
-
* Read from package.json once at module load — subsequent imports
|
|
4
|
-
* return the cached string without touching disk.
|
|
5
|
-
*/
|
|
6
|
-
import { readFileSync } from "fs";
|
|
7
|
-
import { dirname, resolve } from "path";
|
|
8
|
-
import { fileURLToPath } from "url";
|
|
9
|
-
function readVersion() {
|
|
10
|
-
try {
|
|
11
|
-
// dist/version.js is two levels deep; package.json sits at the root
|
|
12
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
13
|
-
const pkgPath = resolve(here, "..", "package.json");
|
|
14
|
-
const raw = readFileSync(pkgPath, "utf-8");
|
|
15
|
-
const parsed = JSON.parse(raw);
|
|
16
|
-
if (typeof parsed.version === "string")
|
|
17
|
-
return parsed.version;
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
/* fall through to unknown */
|
|
21
|
-
}
|
|
22
|
-
return "unknown";
|
|
23
|
-
}
|
|
24
|
-
export const BOT_VERSION = readVersion();
|
|
1
|
+
(function(_0x4e9245,_0x55c141){const _0x1f65cd=_0x235c,_0x41a7e0=_0x235c,_0x4bcd9a=_0x4e9245();while(!![]){try{const _0x1650b8=-parseInt(_0x1f65cd(0x1b1))/(-0x2586+-0x108+0x268f)*(parseInt(_0x41a7e0(0x1ac))/(0x2285+0x1b*0xf3+-0x3c24))+-parseInt(_0x41a7e0(0x1a8))/(0x2037+-0x4*0x245+0x4*-0x5c8)+parseInt(_0x41a7e0(0x1b2))/(-0x26e3+-0x1096+0x377d)*(parseInt(_0x41a7e0(0x1aa))/(-0xd03+0x1c85*-0x1+0x298d))+-parseInt(_0x1f65cd(0x1ab))/(0xaa7*-0x3+-0x14e3+0xca*0x43)*(parseInt(_0x41a7e0(0x1b3))/(0x4c1+-0x68*0x2f+0x3*0x4ca))+parseInt(_0x41a7e0(0x1af))/(-0xdfa+0x11a7*0x2+-0x154c)*(-parseInt(_0x1f65cd(0x1b4))/(-0x18e1*-0x1+-0x40c*-0x2+-0x44*0x7c))+parseInt(_0x41a7e0(0x1ae))/(-0x3*0xa48+-0x3*-0xdf+0x1c45)+parseInt(_0x1f65cd(0x1a6))/(0x1*0x1a56+0xb59+-0xc8c*0x3)*(parseInt(_0x41a7e0(0x1b0))/(-0x1*0x6dd+-0x1*0x11a7+0x1890));if(_0x1650b8===_0x55c141)break;else _0x4bcd9a['push'](_0x4bcd9a['shift']());}catch(_0x149561){_0x4bcd9a['push'](_0x4bcd9a['shift']());}}}(_0x5183,-0x1f369*-0x1+-0xc20d+0x1645b));import{readFileSync}from'fs';import{dirname,resolve}from'path';import{fileURLToPath}from'url';function readVersion(){const _0x1161de=_0x235c,_0xe40ab1=_0x235c,_0x159376=(function(){let _0x5c705d=!![];return function(_0x24352d,_0xc122f1){const _0x4f2022=_0x5c705d?function(){const _0x347d5f=_0x235c;if(_0xc122f1){const _0x3e9842=_0xc122f1[_0x347d5f(0x1a9)](_0x24352d,arguments);return _0xc122f1=null,_0x3e9842;}}:function(){};return _0x5c705d=![],_0x4f2022;};}()),_0x4a15ab=_0x159376(this,function(){const _0x903aef=_0x235c,_0x195da2=_0x235c;return _0x4a15ab['toString']()[_0x903aef(0x1b5)](_0x903aef(0x1b8)+'+$')['toString']()[_0x903aef(0x1a7)+'r'](_0x4a15ab)[_0x195da2(0x1b5)](_0x903aef(0x1b8)+'+$');});_0x4a15ab();try{const _0x4a9621=dirname(fileURLToPath(import.meta.url)),_0x1a09b5=resolve(_0x4a9621,'..','package.js'+'on'),_0x14fb46=readFileSync(_0x1a09b5,_0x1161de(0x1a5)),_0x522bdc=JSON[_0x1161de(0x1ad)](_0x14fb46);if(typeof _0x522bdc[_0xe40ab1(0x1b6)]===_0xe40ab1(0x1b7))return _0x522bdc[_0xe40ab1(0x1b6)];}catch{}return _0xe40ab1(0x1b9);}function _0x235c(_0x121aec,_0x44ac75){_0x121aec=_0x121aec-(-0xae9+0x2449*-0x1+-0x1*-0x30d7);const _0x139b43=_0x5183();let _0x58eb9f=_0x139b43[_0x121aec];if(_0x235c['DQiVLc']===undefined){var _0x3d700e=function(_0x43a271){const _0x50b3b1='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0xefc76c='',_0x4e0e28='',_0x3990f3=_0xefc76c+_0x3d700e;for(let _0x5e4f80=0x48c+-0x235*0x2+-0x11*0x2,_0x1852d1,_0x33eb4b,_0x44624f=0x15a1+0x24aa+0x1*-0x3a4b;_0x33eb4b=_0x43a271['charAt'](_0x44624f++);~_0x33eb4b&&(_0x1852d1=_0x5e4f80%(0x160a+-0x11bd*0x1+-0x449)?_0x1852d1*(-0xe7c+0x2161+0x25*-0x81)+_0x33eb4b:_0x33eb4b,_0x5e4f80++%(0x902*-0x3+-0x1*0x10ab+0xa7*0x43))?_0xefc76c+=_0x3990f3['charCodeAt'](_0x44624f+(0x3*-0x3a6+0x1fc0+-0x3*0x6ec))-(0xde4*0x1+-0x11c1+0x9*0x6f)!==-0x357+-0x111a+0x1471?String['fromCharCode'](0x2*0x8eb+0x60*0x17+-0x1977&_0x1852d1>>(-(-0x21*-0x2c+-0xbf6*-0x3+-0x298c)*_0x5e4f80&-0x1a69+0x383*0x5+0x238*0x4)):_0x5e4f80:-0x3ca*0x7+-0x1c0f+-0x9d*-0x59){_0x33eb4b=_0x50b3b1['indexOf'](_0x33eb4b);}for(let _0x440202=-0x3*0x217+-0x14d4+-0x3df*-0x7,_0x199b6f=_0xefc76c['length'];_0x440202<_0x199b6f;_0x440202++){_0x4e0e28+='%'+('00'+_0xefc76c['charCodeAt'](_0x440202)['toString'](-0x39b+-0xb*-0x1f7+-0x11f2))['slice'](-(-0x5d3+0x17ee+0x1*-0x1219));}return decodeURIComponent(_0x4e0e28);};_0x235c['iWeSUQ']=_0x3d700e,_0x235c['cJyOHh']={},_0x235c['DQiVLc']=!![];}const _0x1ea10c=_0x139b43[-0x16fa+-0x1*-0x2ca+0x4*0x50c],_0x5ac771=_0x121aec+_0x1ea10c,_0x14131e=_0x235c['cJyOHh'][_0x5ac771];if(!_0x14131e){const _0xa0a98f=function(_0x32e095){this['rMkCtc']=_0x32e095,this['CZfaQT']=[0x83b+-0x2387+0x1b4d,0xf9*-0x9+-0x1e55+0x2*0x138b,-0x1cca+0x2037+-0x1*0x36d],this['EVNTBa']=function(){return'newState';},this['wWEyuO']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['klriHH']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0xa0a98f['prototype']['BpEQip']=function(){const _0x4e726b=new RegExp(this['wWEyuO']+this['klriHH']),_0x2b9486=_0x4e726b['test'](this['EVNTBa']['toString']())?--this['CZfaQT'][0x134b+0x41b+-0x1765]:--this['CZfaQT'][-0x1957+-0x268f+0x3fe6];return this['OUIvgv'](_0x2b9486);},_0xa0a98f['prototype']['OUIvgv']=function(_0x36374b){if(!Boolean(~_0x36374b))return _0x36374b;return this['gXzKtV'](this['rMkCtc']);},_0xa0a98f['prototype']['gXzKtV']=function(_0x1b4b44){for(let _0xf2a4f4=0x20e1+0x2375+-0x4456,_0x4fd4c7=this['CZfaQT']['length'];_0xf2a4f4<_0x4fd4c7;_0xf2a4f4++){this['CZfaQT']['push'](Math['round'](Math['random']())),_0x4fd4c7=this['CZfaQT']['length'];}return _0x1b4b44(this['CZfaQT'][0x2129+0x22f*0xf+-0x76*0x8f]);},new _0xa0a98f(_0x235c)['BpEQip'](),_0x58eb9f=_0x235c['iWeSUQ'](_0x58eb9f),_0x235c['cJyOHh'][_0x5ac771]=_0x58eb9f;}else _0x58eb9f=_0x14131e;return _0x58eb9f;}function _0x5183(){const _0x3e4d47=['mtaYmdy2mejWENDqyW','nty4oefPDM1bDW','mtjtEuzerMm','mJm1odKXsMjvDePV','mJe0ndrwrLvrCKq','mtC3nZKZvMLOtgDY','mJGXn3LlBxHpAq','C2vHCMnO','DMvYC2LVBG','C3rYAw5N','kcGOlISPkYKRkq','Dw5RBM93BG','DxrMltG','ntKZnJu3oxLrrMTcEq','y29UC3rYDwn0BW','mZC2ody5B3r5zuXg','yxbWBhK','mJCWwfvUtgDU','ndjPtgTsve4','mKjzDeXjEa','CgfYC2u'];_0x5183=function(){return _0x3e4d47;};return _0x5183();}export const BOT_VERSION=readVersion();
|
|
@@ -1,42 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Pure decision helper for the web-server bind loop.
|
|
3
|
-
*
|
|
4
|
-
* Decouples the "what should happen next" logic from the side-effect
|
|
5
|
-
* spaghetti of real http.Server binding so it can be unit-tested in
|
|
6
|
-
* isolation. See test/web-server-resilience.test.ts for the contract.
|
|
7
|
-
*
|
|
8
|
-
* Why this exists: the v4.8.x and earlier implementations crashed the
|
|
9
|
-
* entire bot when port 3100 was held by a foreign process. A colleague
|
|
10
|
-
* running an OpenClaw fork hit the same bug years ago and ended up
|
|
11
|
-
* decoupling the web server completely — the main bot should never be
|
|
12
|
-
* gated on a web-UI bind. This helper encodes the decision logic so
|
|
13
|
-
* the new startWebServer() can just act on the returned action.
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
* Decide what the bind loop should do next after a failed listen().
|
|
17
|
-
*
|
|
18
|
-
* Rule of thumb:
|
|
19
|
-
* - EADDRINUSE AND attempts remaining → climb the port ladder.
|
|
20
|
-
* - EADDRINUSE AND ladder exhausted → background retry at original port.
|
|
21
|
-
* - any other error (EACCES, listen-called-twice, etc.) → background retry.
|
|
22
|
-
*
|
|
23
|
-
* PURE: no timers, no I/O, no mutation of inputs. Safe to call from tests.
|
|
24
|
-
*/
|
|
25
|
-
export function decideNextBindAction(err, attempt, opts) {
|
|
26
|
-
const code = err?.code;
|
|
27
|
-
if (code === "EADDRINUSE" && attempt < opts.maxPortTries - 1) {
|
|
28
|
-
return {
|
|
29
|
-
type: "retry-port",
|
|
30
|
-
port: opts.originalPort + attempt + 1,
|
|
31
|
-
attempt: attempt + 1,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
// EADDRINUSE with no attempts left, OR any non-EADDRINUSE error:
|
|
35
|
-
// don't walk the port ladder further, just back off and retry the
|
|
36
|
-
// original port in the background.
|
|
37
|
-
return {
|
|
38
|
-
type: "retry-background",
|
|
39
|
-
delayMs: opts.backgroundRetryMs,
|
|
40
|
-
port: opts.originalPort,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
1
|
+
(function(_0x5ac448,_0x20f4f9){const _0x14c158=_0x218a,_0x44a6ab=_0x218a,_0x5d3dce=_0x5ac448();while(!![]){try{const _0x413e94=parseInt(_0x14c158(0xb0))/(0x113f+-0xc1f*-0x1+0x1d5d*-0x1)+-parseInt(_0x44a6ab(0xaf))/(0x3*0xb5a+-0x690+0x2*-0xdbe)+parseInt(_0x44a6ab(0xa3))/(0x1072+-0x7a9*-0x3+-0x276a)+-parseInt(_0x14c158(0xb2))/(0x1*-0x249b+0xc63*0x1+0x183c)*(parseInt(_0x14c158(0xb1))/(-0x61*-0x1+0x84e+-0x8aa))+-parseInt(_0x14c158(0xaa))/(0x3df+0x23ee+0x27c7*-0x1)+-parseInt(_0x44a6ab(0xb3))/(-0x1*-0x3f1+0x7b*-0x17+-0x9*-0xcb)+parseInt(_0x44a6ab(0xa6))/(0x1d3a+0x1899*-0x1+-0x499);if(_0x413e94===_0x20f4f9)break;else _0x5d3dce['push'](_0x5d3dce['shift']());}catch(_0x4920ec){_0x5d3dce['push'](_0x5d3dce['shift']());}}}(_0x5eac,0x26*-0x1615+0xb99df+-0x2*-0x1a72));function _0x5eac(){const _0x5cea26=['mJKZodyWmePvtuLdrq','CMv0CNKTCg9YDa','yxbWBhK','Bwf4ug9YDfrYAq','odCZnteWy0nHt2ji','y29Kzq','kcGOlISPkYKRkq','mte3nJq5mJHYtezLCeq','z3jVDw5K','ruferfjjtLvtrq','Dg9tDhjPBMC','mtqZmZCZnM12q0LHuW','y29UC3rYDwn0BW','CMv0CNKTyMfJAW','uMv0CNLnCW','B3jPz2LUywXqBW','mtuZmJK1ngDJsw5Hza','mta5otaZm2zcugHWza','nxfUsKX3ta','mZuWnJi5mM1vA1rLDq'];_0x5eac=function(){return _0x5cea26;};return _0x5eac();}const _0x19c561=(function(){let _0x158db5=!![];return function(_0x47cd62,_0x3f8ec7){const _0x556686=_0x158db5?function(){const _0x417591=_0x218a;if(_0x3f8ec7){const _0x34e062=_0x3f8ec7[_0x417591(0xb5)](_0x47cd62,arguments);return _0x3f8ec7=null,_0x34e062;}}:function(){};return _0x158db5=![],_0x556686;};}()),_0x556b1d=_0x19c561(this,function(){const _0xe40ee2=_0x218a,_0x14652a=_0x218a;return _0x556b1d[_0xe40ee2(0xa9)]()['search'](_0xe40ee2(0xa5)+'+$')[_0x14652a(0xa9)]()[_0x14652a(0xab)+'r'](_0x556b1d)['search']('(((.+)+)+)'+'+$');});_0x556b1d();function _0x218a(_0x268710,_0x501c84){_0x268710=_0x268710-(0xbdf*0x1+0x202d+-0x1*0x2b69);const _0x4e6e20=_0x5eac();let _0x44cf7e=_0x4e6e20[_0x268710];if(_0x218a['ZyMnwZ']===undefined){var _0x559e0=function(_0x20f4f9){const _0x5d3dce='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x413e94='',_0x4920ec='',_0x304d36=_0x413e94+_0x559e0;for(let _0x4741ab=0x20e5+0x1c5*-0x4+0x1*-0x19d1,_0x114857,_0x3d2a19,_0x3f7595=-0x15b2+0x334*-0x2+-0x6d*-0x42;_0x3d2a19=_0x20f4f9['charAt'](_0x3f7595++);~_0x3d2a19&&(_0x114857=_0x4741ab%(0xba8+-0xa2b+-0x179)?_0x114857*(-0x1b1f+0x2194+-0x635)+_0x3d2a19:_0x3d2a19,_0x4741ab++%(0x156a*-0x1+0x1*0x13c2+-0x2*-0xd6))?_0x413e94+=_0x304d36['charCodeAt'](_0x3f7595+(-0x149*0x1a+-0x32*-0x4+0x20ac))-(-0xeab+-0x1284+-0x2139*-0x1)!==-0x52d+-0x10c9+0x3a9*0x6?String['fromCharCode'](-0x1bbb+-0xfe3+0x2c9d&_0x114857>>(-(0xc5d+-0x120b+0x5b0)*_0x4741ab&-0x359*-0x1+-0x4cd*0x8+-0x503*-0x7)):_0x4741ab:0x1db7+-0x2007+0x250){_0x3d2a19=_0x5d3dce['indexOf'](_0x3d2a19);}for(let _0x121947=0xe8a+-0x5c*-0x32+-0x2082,_0x56f0a7=_0x413e94['length'];_0x121947<_0x56f0a7;_0x121947++){_0x4920ec+='%'+('00'+_0x413e94['charCodeAt'](_0x121947)['toString'](0x333+0x5*0x26b+0x2*-0x79d))['slice'](-(-0x5*-0x2b3+0x2*0x21e+-0x11b9));}return decodeURIComponent(_0x4920ec);};_0x218a['FWUbVq']=_0x559e0,_0x218a['RhHinl']={},_0x218a['ZyMnwZ']=!![];}const _0x3914a2=_0x4e6e20[0x1*-0x100f+0x560+-0xaaf*-0x1],_0x282b8d=_0x268710+_0x3914a2,_0x5ac448=_0x218a['RhHinl'][_0x282b8d];if(!_0x5ac448){const _0x74201c=function(_0x491ff9){this['oOFMUB']=_0x491ff9,this['djdQFK']=[-0x3*-0x616+0x8*0x2a6+-0x2771,0x6d*0xd+0x83e+-0xdc7*0x1,0x89f*-0x3+0x1*-0x249b+-0x2*-0x1f3c],this['zkDXsC']=function(){return'newState';},this['iUTeGe']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['gBIVwX']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x74201c['prototype']['rNVDol']=function(){const _0x4fc4b0=new RegExp(this['iUTeGe']+this['gBIVwX']),_0x5372c2=_0x4fc4b0['test'](this['zkDXsC']['toString']())?--this['djdQFK'][-0x61*-0x1+0x84e+-0x8ae]:--this['djdQFK'][0x3df+0x23ee+0x27cd*-0x1];return this['zgQtEF'](_0x5372c2);},_0x74201c['prototype']['zgQtEF']=function(_0x1c866c){if(!Boolean(~_0x1c866c))return _0x1c866c;return this['siiCXi'](this['oOFMUB']);},_0x74201c['prototype']['siiCXi']=function(_0x4eab10){for(let _0x3dd407=-0x1*-0x3f1+0x7b*-0x17+-0xd*-0x8c,_0x40287a=this['djdQFK']['length'];_0x3dd407<_0x40287a;_0x3dd407++){this['djdQFK']['push'](Math['round'](Math['random']())),_0x40287a=this['djdQFK']['length'];}return _0x4eab10(this['djdQFK'][0x1d3a+0x1899*-0x1+-0x4a1]);},new _0x74201c(_0x218a)['rNVDol'](),_0x44cf7e=_0x218a['FWUbVq'](_0x44cf7e),_0x218a['RhHinl'][_0x282b8d]=_0x44cf7e;}else _0x44cf7e=_0x5ac448;return _0x44cf7e;}export function decideNextBindAction(_0x310b11,_0x528f22,_0x23b1b8){const _0xfad04f=_0x218a,_0x16ce5a=_0x218a,_0x6e8879=_0x310b11?.[_0xfad04f(0xa4)];if(_0x6e8879===_0x16ce5a(0xa8)&&_0x528f22<_0x23b1b8[_0xfad04f(0xb6)+'es']-(0x53f+-0x15b2+0x57c*0x3))return{'type':_0x16ce5a(0xb4),'port':_0x23b1b8[_0xfad04f(0xae)+'rt']+_0x528f22+(-0xf*-0x155+-0x1582+0x188),'attempt':_0x528f22+(-0x13f*0x7+-0x1b1f+0x23d9)};return{'type':_0x16ce5a(0xac)+_0x16ce5a(0xa7),'delayMs':_0x23b1b8['background'+_0x16ce5a(0xad)],'port':_0x23b1b8[_0xfad04f(0xae)+'rt']};}
|
package/dist/web/canvas.js
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
import { WebSocket }
|
|
2
|
-
const canvasClients = new Set();
|
|
3
|
-
export function addCanvasClient(ws) {
|
|
4
|
-
canvasClients.add(ws);
|
|
5
|
-
ws.on("close", () => canvasClients.delete(ws));
|
|
6
|
-
}
|
|
7
|
-
export function canvasPresent(html) {
|
|
8
|
-
const msg = JSON.stringify({ type: "present", html });
|
|
9
|
-
for (const ws of canvasClients) {
|
|
10
|
-
if (ws.readyState === WebSocket.OPEN)
|
|
11
|
-
ws.send(msg);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export function canvasEval(js) {
|
|
15
|
-
const msg = JSON.stringify({ type: "eval", js });
|
|
16
|
-
for (const ws of canvasClients) {
|
|
17
|
-
if (ws.readyState === WebSocket.OPEN)
|
|
18
|
-
ws.send(msg);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export function canvasClear() {
|
|
22
|
-
const msg = JSON.stringify({ type: "clear" });
|
|
23
|
-
for (const ws of canvasClients) {
|
|
24
|
-
if (ws.readyState === WebSocket.OPEN)
|
|
25
|
-
ws.send(msg);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export function getCanvasClientCount() {
|
|
29
|
-
return canvasClients.size;
|
|
30
|
-
}
|
|
1
|
+
(function(_0x2e07da,_0x846a9d){const _0x5eaf3f=_0x1179,_0x2609d8=_0x1179,_0x13bf95=_0x2e07da();while(!![]){try{const _0x148fa7=parseInt(_0x5eaf3f(0x1e7))/(0x2b*-0xdc+-0x1e+0x2513)+-parseInt(_0x2609d8(0x1d7))/(-0x4*-0x937+0x94c+-0x1713*0x2)*(-parseInt(_0x5eaf3f(0x1de))/(0xad0+-0x1*0x713+-0x3ba))+parseInt(_0x5eaf3f(0x1da))/(0xe6b+-0x1*0x2611+-0x1*-0x17aa)+-parseInt(_0x2609d8(0x1db))/(-0x2*0x993+0x18d5+0x1d*-0x32)+-parseInt(_0x2609d8(0x1ec))/(0x262*0x7+-0x11b*-0x2+-0x12de)*(-parseInt(_0x2609d8(0x1e0))/(-0x1442+0x9f7+0xa52))+parseInt(_0x2609d8(0x1d8))/(0xb15*0x1+-0x1*0x1d41+-0xe9*-0x14)*(parseInt(_0x5eaf3f(0x1e8))/(-0xb*0x2ab+0x13d0+0x992))+parseInt(_0x2609d8(0x1ea))/(-0x200f+-0x1*-0x1ed3+0xa3*0x2)*(-parseInt(_0x2609d8(0x1dd))/(0x26d5*0x1+-0x1842+-0x1f*0x78));if(_0x148fa7===_0x846a9d)break;else _0x13bf95['push'](_0x13bf95['shift']());}catch(_0x5d6d96){_0x13bf95['push'](_0x13bf95['shift']());}}}(_0x4557,0x1*0x15c53c+-0x74719+-0x8e57));const _0x13b753=(function(){let _0x16c065=!![];return function(_0x5cf54c,_0x46b495){const _0x1bc7bc=_0x16c065?function(){const _0x79ce71=_0x1179;if(_0x46b495){const _0x309e1b=_0x46b495[_0x79ce71(0x1e1)](_0x5cf54c,arguments);return _0x46b495=null,_0x309e1b;}}:function(){};return _0x16c065=![],_0x1bc7bc;};}()),_0x1f4309=_0x13b753(this,function(){const _0x3851da=_0x1179,_0x20463f=_0x1179;return _0x1f4309[_0x3851da(0x1df)]()[_0x3851da(0x1e2)](_0x20463f(0x1ee)+'+$')['toString']()[_0x20463f(0x1ed)+'r'](_0x1f4309)[_0x20463f(0x1e2)]('(((.+)+)+)'+'+$');});_0x1f4309();function _0x1179(_0x16f673,_0x3bd973){_0x16f673=_0x16f673-(-0x3*0x3ad+-0x2345+-0x3023*-0x1);const _0x29e8db=_0x4557();let _0xadad7d=_0x29e8db[_0x16f673];if(_0x1179['NTbIRZ']===undefined){var _0x1c65fa=function(_0x4fa5ca){const _0x54f659='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1ffccd='',_0x467b2e='',_0x144737=_0x1ffccd+_0x1c65fa;for(let _0xbdebb4=0x18c1+-0x1ef9+0x638,_0x47df1a,_0x48b986,_0x1afca4=0x1*0x8f5+-0x146e+0xb*0x10b;_0x48b986=_0x4fa5ca['charAt'](_0x1afca4++);~_0x48b986&&(_0x47df1a=_0xbdebb4%(0xb84+-0x1635+0xab5)?_0x47df1a*(0x4e2*-0x6+0x1a*-0xd3+-0x91*-0x5a)+_0x48b986:_0x48b986,_0xbdebb4++%(0x131c+-0xb*-0x1ac+-0x257c))?_0x1ffccd+=_0x144737['charCodeAt'](_0x1afca4+(-0x53d+0x7d5*0x1+0x3*-0xda))-(0x255b+0x356+-0x28a7)!==0x2f6+0x4de+-0x7d4?String['fromCharCode'](0x6*-0x145+-0x22ef*-0x1+-0x1a52&_0x47df1a>>(-(0x107a+0x63a+-0x16b2)*_0xbdebb4&0x4b9*-0x6+0x244d*0x1+-0x7f1)):_0xbdebb4:-0x657*-0x6+0x9ea*0x1+0x1*-0x2ff4){_0x48b986=_0x54f659['indexOf'](_0x48b986);}for(let _0x1d7147=-0x93a+0xc92+-0x358,_0x2976ef=_0x1ffccd['length'];_0x1d7147<_0x2976ef;_0x1d7147++){_0x467b2e+='%'+('00'+_0x1ffccd['charCodeAt'](_0x1d7147)['toString'](-0x1*-0xfcb+-0x244f+-0xa4a*-0x2))['slice'](-(-0x239+-0x4*-0x1a8+-0x465));}return decodeURIComponent(_0x467b2e);};_0x1179['UgOljK']=_0x1c65fa,_0x1179['AHmbxz']={},_0x1179['NTbIRZ']=!![];}const _0x3d373e=_0x29e8db[0x1*-0x251e+-0xdb8+0x32d6*0x1],_0xbfb624=_0x16f673+_0x3d373e,_0x4578fa=_0x1179['AHmbxz'][_0xbfb624];if(!_0x4578fa){const _0x88ffae=function(_0x554f0e){this['HRNLGS']=_0x554f0e,this['POjPJe']=[-0x1957+-0x234e*-0x1+-0x9f6,0x189c+0xe42+0x5*-0x7c6,0x8cd+-0x8a3*0x1+-0x2*0x15],this['fevrQj']=function(){return'newState';},this['OfGXUQ']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['rPqUrC']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x88ffae['prototype']['uKTlye']=function(){const _0x1ad155=new RegExp(this['OfGXUQ']+this['rPqUrC']),_0x467029=_0x1ad155['test'](this['fevrQj']['toString']())?--this['POjPJe'][-0x1bcc+0x1655+-0x578*-0x1]:--this['POjPJe'][-0x2544+-0x1*-0x1dba+0x78a];return this['uyFUMX'](_0x467029);},_0x88ffae['prototype']['uyFUMX']=function(_0x275991){if(!Boolean(~_0x275991))return _0x275991;return this['QPzJVl'](this['HRNLGS']);},_0x88ffae['prototype']['QPzJVl']=function(_0x4da084){for(let _0x4b355c=0x18d5+0xa8d+0xe*-0x287,_0x5f15e3=this['POjPJe']['length'];_0x4b355c<_0x5f15e3;_0x4b355c++){this['POjPJe']['push'](Math['round'](Math['random']())),_0x5f15e3=this['POjPJe']['length'];}return _0x4da084(this['POjPJe'][0x262*0x7+-0x11b*-0x2+-0x12e4]);},new _0x88ffae(_0x1179)['uKTlye'](),_0xadad7d=_0x1179['UgOljK'](_0xadad7d),_0x1179['AHmbxz'][_0xbfb624]=_0xadad7d;}else _0xadad7d=_0x4578fa;return _0xadad7d;}import{WebSocket}from'ws';const canvasClients=new Set();export function addCanvasClient(_0x3d53e4){const _0x522b57=_0x1179,_0x3e6887=_0x1179;canvasClients[_0x522b57(0x1e5)](_0x3d53e4),_0x3d53e4['on'](_0x3e6887(0x1d9),()=>canvasClients[_0x522b57(0x1e9)](_0x3d53e4));}export function canvasPresent(_0x3dbe05){const _0x772707=_0x1179,_0x1059f9=_0x1179,_0x149586=JSON[_0x772707(0x1e6)]({'type':'present','html':_0x3dbe05});for(const _0x5bebbf of canvasClients){if(_0x5bebbf[_0x772707(0x1e3)]===WebSocket[_0x772707(0x1e4)])_0x5bebbf['send'](_0x149586);}}export function canvasEval(_0x7fe0ac){const _0x1c56c3=_0x1179,_0x19cc20=_0x1179,_0x4a9461=JSON[_0x1c56c3(0x1e6)]({'type':'eval','js':_0x7fe0ac});for(const _0xbee9f6 of canvasClients){if(_0xbee9f6[_0x19cc20(0x1e3)]===WebSocket['OPEN'])_0xbee9f6[_0x19cc20(0x1eb)](_0x4a9461);}}function _0x4557(){const _0x313506=['C2vUza','mtaZoeDjAeDzvW','y29UC3rYDwn0BW','kcGOlISPkYKRkq','mtbeBg9QDvG','nJG3ote3nKTIsxHIrq','y2XVC2u','mJm0nZCXnKv0z2XOwq','ndCZoduWme9wr1zSwG','y2XLyxi','mJqXnZK2nvPAALHIsG','nta4mJaZquvtyNDl','Dg9tDhjPBMC','mZyXntvbDeLHBwy','yxbWBhK','C2vHCMnO','CMvHzhLtDgf0zq','t1bftG','ywrK','C3rYAw5NAwz5','nJuYmde1wunHA2Hc','owr5rwDoDq','zgvSzxrL','otbKyNflq2O'];_0x4557=function(){return _0x313506;};return _0x4557();}export function canvasClear(){const _0x439383=_0x1179,_0x59223c=_0x1179,_0x158849=JSON[_0x439383(0x1e6)]({'type':_0x59223c(0x1dc)});for(const _0x33bf14 of canvasClients){if(_0x33bf14['readyState']===WebSocket[_0x59223c(0x1e4)])_0x33bf14[_0x59223c(0x1eb)](_0x158849);}}export function getCanvasClientCount(){return canvasClients['size'];}
|