alvin-bot 5.7.0 → 5.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/claude.js +1 -102
  3. package/dist/config.js +1 -96
  4. package/dist/engine.js +1 -90
  5. package/dist/find-claude-binary.js +1 -98
  6. package/dist/handlers/async-agent-chunk-handler.js +1 -50
  7. package/dist/handlers/background-bypass.js +1 -75
  8. package/dist/handlers/commands.js +1 -2336
  9. package/dist/handlers/cron-progress.js +1 -52
  10. package/dist/handlers/document.js +1 -194
  11. package/dist/handlers/message.js +1 -959
  12. package/dist/handlers/photo.js +1 -154
  13. package/dist/handlers/platform-message.js +1 -360
  14. package/dist/handlers/stuck-timer.js +1 -54
  15. package/dist/handlers/video.js +1 -237
  16. package/dist/handlers/voice.js +1 -148
  17. package/dist/i18n.js +1 -805
  18. package/dist/index.js +1 -697
  19. package/dist/init-data-dir.js +1 -98
  20. package/dist/middleware/auth.js +1 -233
  21. package/dist/migrate.js +1 -162
  22. package/dist/paths.js +1 -146
  23. package/dist/platforms/discord.js +1 -175
  24. package/dist/platforms/index.js +1 -130
  25. package/dist/platforms/signal.js +1 -205
  26. package/dist/platforms/slack-slash-parser.js +1 -32
  27. package/dist/platforms/slack.js +1 -501
  28. package/dist/platforms/telegram.js +1 -111
  29. package/dist/platforms/types.js +1 -8
  30. package/dist/platforms/whatsapp-auth-helpers.js +1 -53
  31. package/dist/platforms/whatsapp.js +1 -707
  32. package/dist/providers/claude-sdk-provider.js +1 -565
  33. package/dist/providers/codex-cli-provider.js +1 -134
  34. package/dist/providers/index.js +1 -7
  35. package/dist/providers/ollama-provider.js +1 -32
  36. package/dist/providers/openai-compatible.js +1 -406
  37. package/dist/providers/registry.js +1 -352
  38. package/dist/providers/runtime-header.js +1 -45
  39. package/dist/providers/tool-executor.js +1 -475
  40. package/dist/providers/types.js +1 -227
  41. package/dist/services/access.js +1 -144
  42. package/dist/services/allowed-users-gate.js +1 -56
  43. package/dist/services/alvin-dispatch.js +1 -174
  44. package/dist/services/alvin-mcp-tools.js +1 -104
  45. package/dist/services/asset-index.js +1 -224
  46. package/dist/services/async-agent-parser.js +1 -418
  47. package/dist/services/async-agent-watcher.js +1 -583
  48. package/dist/services/auto-diagnostic.js +1 -228
  49. package/dist/services/broadcast.js +1 -52
  50. package/dist/services/browser-manager.js +1 -562
  51. package/dist/services/browser-webfetch.js +1 -127
  52. package/dist/services/browser.js +1 -121
  53. package/dist/services/cdp-bootstrap.js +1 -357
  54. package/dist/services/compaction.js +1 -144
  55. package/dist/services/critical-notify.js +1 -203
  56. package/dist/services/cron-resolver.js +1 -58
  57. package/dist/services/cron-scheduling.js +1 -310
  58. package/dist/services/cron.js +1 -861
  59. package/dist/services/custom-tools.js +1 -317
  60. package/dist/services/delivery-queue.js +1 -173
  61. package/dist/services/delivery-registry.js +1 -21
  62. package/dist/services/disk-cleanup.js +1 -203
  63. package/dist/services/elevenlabs.js +1 -58
  64. package/dist/services/embeddings/auto-detect.js +1 -74
  65. package/dist/services/embeddings/fts5.js +1 -108
  66. package/dist/services/embeddings/gemini.js +1 -65
  67. package/dist/services/embeddings/index.js +1 -496
  68. package/dist/services/embeddings/ollama.js +1 -78
  69. package/dist/services/embeddings/openai.js +1 -49
  70. package/dist/services/embeddings/provider.js +1 -22
  71. package/dist/services/embeddings/vector-base.js +1 -113
  72. package/dist/services/embeddings-migration.js +1 -193
  73. package/dist/services/embeddings.js +1 -9
  74. package/dist/services/env-file.js +1 -50
  75. package/dist/services/exec-guard.js +1 -71
  76. package/dist/services/fallback-order.js +1 -154
  77. package/dist/services/file-permissions.js +1 -93
  78. package/dist/services/heartbeat-file.js +1 -65
  79. package/dist/services/heartbeat.js +1 -313
  80. package/dist/services/hooks.js +1 -44
  81. package/dist/services/imagegen.js +1 -72
  82. package/dist/services/language-detect.js +1 -154
  83. package/dist/services/markdown.js +1 -63
  84. package/dist/services/mcp.js +1 -263
  85. package/dist/services/memory-extractor.js +1 -178
  86. package/dist/services/memory-inject-mode.js +1 -43
  87. package/dist/services/memory-layers.js +1 -156
  88. package/dist/services/memory.js +1 -146
  89. package/dist/services/ollama-manager.js +1 -339
  90. package/dist/services/permissions-wizard.js +1 -291
  91. package/dist/services/personality.js +1 -376
  92. package/dist/services/plugins.js +1 -171
  93. package/dist/services/preflight.js +1 -292
  94. package/dist/services/process-manager.js +1 -291
  95. package/dist/services/release-highlights.js +1 -79
  96. package/dist/services/reminders.js +1 -97
  97. package/dist/services/restart.js +1 -48
  98. package/dist/services/security-audit.js +1 -74
  99. package/dist/services/self-diagnosis.js +1 -272
  100. package/dist/services/self-search.js +1 -129
  101. package/dist/services/session-persistence.js +1 -237
  102. package/dist/services/session.js +1 -282
  103. package/dist/services/skills.js +1 -290
  104. package/dist/services/ssrf-guard.js +1 -162
  105. package/dist/services/standing-orders.js +1 -29
  106. package/dist/services/steer-channel.js +1 -46
  107. package/dist/services/stop-controller.js +1 -52
  108. package/dist/services/subagent-dedup.js +1 -86
  109. package/dist/services/subagent-delivery.js +1 -452
  110. package/dist/services/subagent-stats.js +1 -123
  111. package/dist/services/subagents.js +1 -814
  112. package/dist/services/sudo.js +1 -329
  113. package/dist/services/telegram.js +1 -158
  114. package/dist/services/timing-safe-bearer.js +1 -51
  115. package/dist/services/tool-discovery.js +1 -214
  116. package/dist/services/trends.js +1 -580
  117. package/dist/services/updater.js +1 -291
  118. package/dist/services/usage-tracker.js +1 -144
  119. package/dist/services/users.js +1 -271
  120. package/dist/services/voice.js +1 -104
  121. package/dist/services/watchdog-brake.js +1 -154
  122. package/dist/services/watchdog.js +1 -311
  123. package/dist/services/workspaces.js +1 -276
  124. package/dist/tui/index.js +1 -667
  125. package/dist/util/console-formatter.js +1 -109
  126. package/dist/util/debounce.js +1 -24
  127. package/dist/util/telegram-error-filter.js +1 -62
  128. package/dist/version.js +1 -24
  129. package/dist/web/bind-strategy.js +1 -42
  130. package/dist/web/canvas.js +1 -30
  131. package/dist/web/doctor-api.js +1 -604
  132. package/dist/web/openai-compat.js +1 -252
  133. package/dist/web/server.js +1 -1902
  134. package/dist/web/setup-api.js +1 -1101
  135. package/package.json +5 -2
  136. package/dist/.metadata_never_index +0 -0
@@ -1,75 +1 @@
1
- /**
2
- * v4.12.3 — Background-agent bypass helpers.
3
- *
4
- * Pure state-machine helpers used by the Telegram + platform message
5
- * handlers to decide whether to:
6
- * 1. Abort a running query instead of queueing the next user message,
7
- * when the running query is blocked waiting for a background
8
- * task-notification (SDK's CLI subprocess stays alive for the full
9
- * duration of the background task).
10
- * 2. Start the next SDK query with a fresh session (sessionId=null)
11
- * when any background agent is still pending, so the new query
12
- * doesn't inherit the old session's block.
13
- *
14
- * These are separated into their own module so they can be unit tested
15
- * without a grammy Context mock.
16
- */
17
- /**
18
- * Decide whether to bypass the normal "queue this message" branch and
19
- * interrupt the running query so the new message can proceed immediately.
20
- *
21
- * True when:
22
- * - A query is currently running (`isProcessing`)
23
- * - At least one background agent is pending in this session
24
- * - An unaborted abortController exists to cancel the running query
25
- *
26
- * Otherwise false → fall back to the normal queue/drop behavior.
27
- */
28
- export function shouldBypassQueue(state) {
29
- if (!state.isProcessing)
30
- return false;
31
- if (state.pendingBackgroundCount <= 0)
32
- return false;
33
- const ac = state.abortController;
34
- if (!ac)
35
- return false;
36
- if (ac.signal.aborted)
37
- return false;
38
- return true;
39
- }
40
- /**
41
- * Decide whether the next SDK query should skip `resume: sessionId`
42
- * and start a fresh session instead. Needed when a background agent is
43
- * still pending — resuming the original session would inherit its block
44
- * (the SDK's CLI subprocess for that session is waiting to deliver the
45
- * task-notification inline). A fresh session has no such block and
46
- * proceeds immediately. Context is preserved via the bridge preamble
47
- * (buildBridgeMessage in message.ts).
48
- */
49
- export function shouldBypassSdkResume(state) {
50
- return state.pendingBackgroundCount > 0;
51
- }
52
- /**
53
- * Poll-wait until `session.isProcessing` becomes false (or the timeout
54
- * elapses). Returns true if the flag flipped, false on timeout.
55
- *
56
- * Used by the bypass path: after calling `abort()` on the running query,
57
- * we wait for its finally block to run and flip isProcessing=false
58
- * before starting the new query. The handler's own message loop is the
59
- * one flipping the flag, so we just have to yield the event loop and
60
- * re-check.
61
- *
62
- * Timeouts above 0 are recommended. Default tick interval is 50ms which
63
- * is short enough that the fall-through feels instant to the user.
64
- */
65
- export async function waitUntilProcessingFalse(session, timeoutMs, tickMs = 50) {
66
- if (!session.isProcessing)
67
- return true;
68
- const start = Date.now();
69
- while (session.isProcessing) {
70
- if (Date.now() - start >= timeoutMs)
71
- return false;
72
- await new Promise((resolve) => setTimeout(resolve, tickMs));
73
- }
74
- return true;
75
- }
1
+ (function(_0x4453f1,_0x555b12){const _0x3c237f=_0x33f2,_0x205f1d=_0x33f2,_0x302d00=_0x4453f1();while(!![]){try{const _0x230c7b=-parseInt(_0x3c237f(0x1c2))/(0x2663+-0x1*-0x39c+-0x32*0xd7)*(-parseInt(_0x3c237f(0x1b7))/(0x5cc+-0x15*0x10f+0x17*0xb7))+parseInt(_0x205f1d(0x1bf))/(-0x1315*-0x1+-0x235+-0x10dd)+parseInt(_0x205f1d(0x1b6))/(0x1282+-0x2*0x713+-0x458)*(parseInt(_0x205f1d(0x1c3))/(-0x1ab*0x15+0xe4b*-0x2+0x3fa2))+-parseInt(_0x3c237f(0x1c1))/(0x23*0xa+0x7fa*0x3+0x5*-0x50e)*(parseInt(_0x205f1d(0x1bc))/(-0x1b6c+0xb*-0x81+0x20fe))+-parseInt(_0x3c237f(0x1b9))/(-0x1cba+-0xa6b+-0x272d*-0x1)+-parseInt(_0x205f1d(0x1c5))/(-0x205+0x1b32+-0x1*0x1924)+-parseInt(_0x205f1d(0x1c8))/(0x26*-0x34+0x23*-0x43+0x1*0x10eb)*(-parseInt(_0x205f1d(0x1c6))/(-0x25a7+-0xab4+-0x15*-0x24e));if(_0x230c7b===_0x555b12)break;else _0x302d00['push'](_0x302d00['shift']());}catch(_0xe22bc7){_0x302d00['push'](_0x302d00['shift']());}}}(_0x44ff,0x14bad+0xd9831+-0x761a7));const _0x3bbae5=(function(){let _0x1b2865=!![];return function(_0x5bfbb7,_0xe5eade){const _0x4a0f31=_0x1b2865?function(){if(_0xe5eade){const _0x1ccc2a=_0xe5eade['apply'](_0x5bfbb7,arguments);return _0xe5eade=null,_0x1ccc2a;}}:function(){};return _0x1b2865=![],_0x4a0f31;};}()),_0xba16f=_0x3bbae5(this,function(){const _0x5daf52=_0x33f2,_0x56dddd=_0x33f2;return _0xba16f[_0x5daf52(0x1c7)]()['search']('(((.+)+)+)'+'+$')['toString']()[_0x5daf52(0x1be)+'r'](_0xba16f)['search']('(((.+)+)+)'+'+$');});function _0x33f2(_0x12e1b7,_0x315b54){_0x12e1b7=_0x12e1b7-(-0x18fc*0x1+0xf*-0x25+-0x1cdd*-0x1);const _0x4ce54c=_0x44ff();let _0x56c525=_0x4ce54c[_0x12e1b7];if(_0x33f2['fJbdzW']===undefined){var _0x4e65d4=function(_0x3c02d5){const _0xe37e80='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x28ec12='',_0x54f8a9='',_0x3cd75e=_0x28ec12+_0x4e65d4;for(let _0x3db5ca=-0x2650+0xf17+-0x1*-0x1739,_0x1c5b53,_0xca0b98,_0x22f979=-0x1bf4*0x1+-0x9de+0x25d2;_0xca0b98=_0x3c02d5['charAt'](_0x22f979++);~_0xca0b98&&(_0x1c5b53=_0x3db5ca%(0x44a+0x10e6+-0x152c)?_0x1c5b53*(0x15*0x139+0x17c1+-0x5*0x9d6)+_0xca0b98:_0xca0b98,_0x3db5ca++%(-0x10d2+-0x39*-0xa3+-0x1375*0x1))?_0x28ec12+=_0x3cd75e['charCodeAt'](_0x22f979+(-0xf5f+0x1d87+-0xe1e))-(0x24af*-0x1+-0xd*0x63+0x29c0)!==-0x2460+0x24c7+0x1*-0x67?String['fromCharCode'](0x1a87+-0x5bd+-0x233*0x9&_0x1c5b53>>(-(0x1cef+0x1*-0x17cb+-0x522*0x1)*_0x3db5ca&-0x1*0x18c1+0x16c+0x175b)):_0x3db5ca:-0x2d4+-0x1*-0x1c96+0x6*-0x44b){_0xca0b98=_0xe37e80['indexOf'](_0xca0b98);}for(let _0x32a146=-0x4da*0x7+-0x1*-0xc26+0x15d*0x10,_0x506cfa=_0x28ec12['length'];_0x32a146<_0x506cfa;_0x32a146++){_0x54f8a9+='%'+('00'+_0x28ec12['charCodeAt'](_0x32a146)['toString'](-0x1*0x259b+0x1811*-0x1+0x3dbc))['slice'](-(-0x1*-0x14bd+-0x1*0x7c2+-0x3*0x453));}return decodeURIComponent(_0x54f8a9);};_0x33f2['YEViwi']=_0x4e65d4,_0x33f2['jPAsAQ']={},_0x33f2['fJbdzW']=!![];}const _0x476668=_0x4ce54c[-0x1fad+0x25b4+0x607*-0x1],_0x4e2101=_0x12e1b7+_0x476668,_0x5a712c=_0x33f2['jPAsAQ'][_0x4e2101];if(!_0x5a712c){const _0x4c3efe=function(_0xec9e4){this['efmHhM']=_0xec9e4,this['ykgJvL']=[0x1464+-0x16dd*-0x1+0x15a*-0x20,0x583+-0x28d*-0x1+-0x810,0x5ce+0x267e*0x1+-0xe*0x32a],this['stXpIr']=function(){return'newState';},this['itNnsS']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['oyuDNf']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x4c3efe['prototype']['gdbIwt']=function(){const _0x2d3912=new RegExp(this['itNnsS']+this['oyuDNf']),_0x50e1c7=_0x2d3912['test'](this['stXpIr']['toString']())?--this['ykgJvL'][-0x1*-0x18a7+-0x25*0x6+-0x17c8]:--this['ykgJvL'][0x1f*0x4a+-0x1*0x1247+-0x951*-0x1];return this['psQcZB'](_0x50e1c7);},_0x4c3efe['prototype']['psQcZB']=function(_0x2a3f6c){if(!Boolean(~_0x2a3f6c))return _0x2a3f6c;return this['mhxkZJ'](this['efmHhM']);},_0x4c3efe['prototype']['mhxkZJ']=function(_0x1ef4f4){for(let _0x4cc317=-0x1*0x2e7+-0x2439+-0x10*-0x272,_0x2b4b00=this['ykgJvL']['length'];_0x4cc317<_0x2b4b00;_0x4cc317++){this['ykgJvL']['push'](Math['round'](Math['random']())),_0x2b4b00=this['ykgJvL']['length'];}return _0x1ef4f4(this['ykgJvL'][-0x2387+-0x1ab*0x15+0x335*0x16]);},new _0x4c3efe(_0x33f2)['gdbIwt'](),_0x56c525=_0x33f2['YEViwi'](_0x56c525),_0x33f2['jPAsAQ'][_0x4e2101]=_0x56c525;}else _0x56c525=_0x5a712c;return _0x56c525;}_0xba16f();export function shouldBypassQueue(_0x45bec4){const _0x16b409=_0x33f2,_0x2cf3ae=_0x33f2;if(!_0x45bec4[_0x16b409(0x1c0)+'ng'])return![];if(_0x45bec4[_0x16b409(0x1bb)+_0x2cf3ae(0x1ba)+'nt']<=-0x1ce+-0x1bf4*0x1+0x1dc2)return![];const _0x8430df=_0x45bec4[_0x16b409(0x1c9)+'oller'];if(!_0x8430df)return![];if(_0x8430df[_0x2cf3ae(0x1b8)][_0x16b409(0x1c4)])return![];return!![];}export function shouldBypassSdkResume(_0x1ced01){const _0x5df3f3=_0x33f2;return _0x1ced01[_0x5df3f3(0x1bb)+'kgroundCou'+'nt']>-0x11fb*0x1+0x44a+0xdb1;}export async function waitUntilProcessingFalse(_0x53bab9,_0x1ca8db,_0x199297=0x15*0x139+0x17c1+-0x17*0x224){const _0x2dfd93=_0x33f2,_0x114b52=_0x33f2;if(!_0x53bab9['isProcessi'+'ng'])return!![];const _0x426716=Date['now']();while(_0x53bab9[_0x2dfd93(0x1c0)+'ng']){if(Date[_0x114b52(0x1bd)]()-_0x426716>=_0x1ca8db)return![];await new Promise(_0x2e9e59=>setTimeout(_0x2e9e59,_0x199297));}return!![];}function _0x44ff(){const _0x4662e3=['AxnqCM9JzxnZAq','nLn2ufPZtG','nfrRBvndwG','mta0nJvmEKrpywO','ywjVCNrLza','odi0nZG3ovLougvbzG','nZK2ngf4rfPIrG','Dg9tDhjPBMC','nZuYmenqrejQwG','ywjVCNrdB250CG','ndm2t0zKsvPK','nda5oti0y2PbvNb0','C2LNBMfS','ntC1ntyZmNzLwMvPra','A2DYB3vUzenVDq','CgvUzgLUz0jHyW','mJC0mdiZnhvtBLn6ua','BM93','y29UC3rYDwn0BW','mJC4mtaWm3b5vhzjEa'];_0x44ff=function(){return _0x4662e3;};return _0x44ff();}