stableclaw 2026.4.6 → 2026.4.8
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/README.md +22 -290
- package/package.json +1 -73
- package/dist/.buildstamp +0 -1
- package/dist/abort-C9luPDzM.js +0 -192
- package/dist/abort-cutoff-B1ws4nOb.js +0 -56
- package/dist/abort-cutoff.runtime-DyRUNN6p.js +0 -20
- package/dist/abort-cutoff.runtime.js +0 -1
- package/dist/abort-primitives-CGyFwJ93.js +0 -92
- package/dist/abort-signal-CrrraMAi.js +0 -13
- package/dist/abort.runtime-oBiooAFx.js +0 -2
- package/dist/abort.runtime.js +0 -1
- package/dist/access-DIqrGWVo.js +0 -81
- package/dist/access-control-DfV6HWO9.js +0 -152
- package/dist/account-action-gate-eHi2MB4J.js +0 -12
- package/dist/account-core-DOelA7Wl.js +0 -26
- package/dist/account-helpers-CafpxP7V.js +0 -1
- package/dist/account-helpers-jJOgsae3.js +0 -102
- package/dist/account-id-DXal1kRJ.js +0 -1
- package/dist/account-inspect-CfagweUE.js +0 -158
- package/dist/account-inspect-DOt4IDX6.js +0 -92
- package/dist/account-inspect-pnXre-7b.js +0 -81
- package/dist/account-lookup-CLJxpfHr.js +0 -17
- package/dist/account-resolution-CbKUJkzG.js +0 -30
- package/dist/account-selection-B8a_DqXo.js +0 -222
- package/dist/account-snapshot-fields-mr-1u321.js +0 -130
- package/dist/account-summary-DA6ds0Hk.js +0 -36
- package/dist/accounts-CO-lK8jJ.js +0 -150
- package/dist/accounts-D419O6Gq.js +0 -2
- package/dist/accounts-DKMLcV4g.js +0 -132
- package/dist/accounts-DdiZwn14.js +0 -57
- package/dist/accounts-SWhOQhoA.js +0 -58
- package/dist/accounts-iR2U_Vs4.js +0 -41
- package/dist/accounts-jsSym1md.js +0 -102
- package/dist/accounts-p4Eir-wB.js +0 -107
- package/dist/accounts-uAWNlC7q.js +0 -94
- package/dist/accounts-x23pAGjm.js +0 -137
- package/dist/accounts.runtime-PJOhs60R.js +0 -2
- package/dist/accounts.runtime.js +0 -1
- package/dist/ack-reactions-fcKs7CQ_.js +0 -43
- package/dist/acp-cli-ByWTIhFx.js +0 -2207
- package/dist/acp-runtime-D7wrReOP.js +0 -8
- package/dist/acp-stateful-target-driver-DY2EfkQt.js +0 -60
- package/dist/action-runtime-BdRtmydq.js +0 -318
- package/dist/action-runtime-DvNB5A61.js +0 -72
- package/dist/action-runtime-api-BnVs42oX.js +0 -1028
- package/dist/actions-CUYHtUqe.js +0 -531
- package/dist/actions.runtime-BBrSlYkH.js +0 -18
- package/dist/actions.runtime-DB4aKmBO.js +0 -5
- package/dist/actions.runtime-bdKprwSE.js +0 -2
- package/dist/actions.runtime.js +0 -1
- package/dist/active-listener-SB9ihcaC.js +0 -46
- package/dist/agent-command-C_MGil8o.js +0 -1457
- package/dist/agent-list-MRXQwyo0.js +0 -52
- package/dist/agent-media-payload-DDTSvr-n.js +0 -17
- package/dist/agent-paths-D711oayD.js +0 -12
- package/dist/agent-runner-utils-DEYzwZHa.js +0 -182
- package/dist/agent-runner.runtime-v2uIsAVy.js +0 -2218
- package/dist/agent-runner.runtime.js +0 -1
- package/dist/agent-runtime-Cz19IsmJ.js +0 -142
- package/dist/agent-s4m0Xp6V.js +0 -2
- package/dist/agent-scope-rWWUivuC.js +0 -215
- package/dist/agent-tools-login-DU1gQC9-.js +0 -57
- package/dist/agents/auth-profiles.runtime.js +0 -7
- package/dist/agents/pi-model-discovery-runtime.js +0 -2
- package/dist/agents-B2W3IoEe.js +0 -888
- package/dist/agents-DmE3LRim.js +0 -5
- package/dist/agents.config-D6XoJFQ-.js +0 -3
- package/dist/agents.config-Ui_tQc3C.js +0 -121
- package/dist/allow-from-Bj0HDNYh.js +0 -20
- package/dist/allow-from-CJwSUt_K.js +0 -9
- package/dist/allow-from-xOap1t02.js +0 -62
- package/dist/allow-list-DeRUbyj4.js +0 -319
- package/dist/allowed-updates-aOgPxM0g.js +0 -31
- package/dist/allowlist-config-edit-Ch2EvAYo.js +0 -279
- package/dist/allowlist-match-Dm6AqFEs.js +0 -63
- package/dist/ansi-B_0KjIJj.js +0 -54
- package/dist/anthropic-vertex-Stff_3_3.js +0 -21
- package/dist/anthropic-vertex-stream-DgR8-m-G.js +0 -653
- package/dist/api-7Pf2fGBp.js +0 -11
- package/dist/api-B80kCRiV.js +0 -11
- package/dist/api-B8_Wwelx.js +0 -2
- package/dist/api-BLI24uxW.js +0 -2
- package/dist/api-BLSg8PM8.js +0 -2
- package/dist/api-BRy2h4ZA.js +0 -2
- package/dist/api-BU_YBaOK.js +0 -3
- package/dist/api-BXQjqvPC.js +0 -2
- package/dist/api-BY9iT-AK.js +0 -106
- package/dist/api-BipiQQoS.js +0 -2
- package/dist/api-Bk5mFOju.js +0 -10
- package/dist/api-BrsLZRXn.js +0 -3
- package/dist/api-C16j1Xno.js +0 -2
- package/dist/api-CGtiPyfv.js +0 -8358
- package/dist/api-CHIsf5Wl.js +0 -21
- package/dist/api-CP9q4gi6.js +0 -19
- package/dist/api-CWPDpJCM.js +0 -2
- package/dist/api-CaMdAP9T.js +0 -2
- package/dist/api-CftMlodx.js +0 -5
- package/dist/api-Cpj_QQAF.js +0 -5
- package/dist/api-D13mhDzE.js +0 -33
- package/dist/api-DGcbqpSh.js +0 -2
- package/dist/api-DIGFhGqm.js +0 -30
- package/dist/api-DNxTJAiA.js +0 -5
- package/dist/api-DasNTWRo.js +0 -2
- package/dist/api-Dn7n2sWC.js +0 -74
- package/dist/api-Drq06O1M2.js +0 -6
- package/dist/api-OOJHubHS.js +0 -77
- package/dist/api-XH46JouJ.js +0 -2
- package/dist/api-builder-uuKvRs_O.js +0 -66
- package/dist/api-e3cIcFaV.js +0 -1
- package/dist/api-fetch-CvBBI8q8.js +0 -35
- package/dist/api-key-rotation-BCssmYGp.js +0 -150
- package/dist/api-rPpH8518.js +0 -322
- package/dist/api-w-46PN0B.js +0 -2
- package/dist/apply-DfjUTAkv.js +0 -485
- package/dist/apply.runtime-B-srtEUl.js +0 -2
- package/dist/apply.runtime-DOG87kW8.js +0 -166
- package/dist/apply.runtime.js +0 -1
- package/dist/approval-native-CI9-iVJa.js +0 -79
- package/dist/approval-native-runtime-2AVlvrdL.js +0 -399
- package/dist/approval-renderers-BTKeDNRo.js +0 -87
- package/dist/approval-runtime-DIA8ohXa.js +0 -262
- package/dist/archive-BaCqqQP1.js +0 -537
- package/dist/arg-split-get0R_Yr.js +0 -38
- package/dist/artifacts-DXKlQp1z.js +0 -52
- package/dist/assistant-error-format-CFSPB8qt.js +0 -109
- package/dist/async-lock-QqhPYwhW.js +0 -19
- package/dist/attachment-normalize-CMMyswNa.js +0 -921
- package/dist/audio-BxqNDSFq.js +0 -53
- package/dist/audio-DZWA6M9B.js +0 -41
- package/dist/audit-86J-sIQq.js +0 -54
- package/dist/audit-D9O3O-41.js +0 -86
- package/dist/audit-DwAT-Kzg.js +0 -892
- package/dist/audit-channel.allow-from.runtime-DmuUvr2f.js +0 -5
- package/dist/audit-channel.allow-from.runtime.js +0 -1
- package/dist/audit-channel.collect.runtime-B76LAkrF.js +0 -528
- package/dist/audit-channel.collect.runtime.js +0 -1
- package/dist/audit-channel.discord.runtime-qM5u1Hnl.js +0 -5
- package/dist/audit-channel.discord.runtime.js +0 -1
- package/dist/audit-channel.telegram.runtime-DpwmRUPy.js +0 -8
- package/dist/audit-channel.telegram.runtime.js +0 -1
- package/dist/audit-channel.zalouser.runtime-CzlFZYsv.js +0 -5
- package/dist/audit-channel.zalouser.runtime.js +0 -1
- package/dist/audit-extra.async-BupKW2BB.js +0 -820
- package/dist/audit-fs-B3GdTjId.js +0 -375
- package/dist/audit-membership-runtime-n195y1jy.js +0 -55
- package/dist/audit.deep.runtime-2gZPpwj8.js +0 -2
- package/dist/audit.deep.runtime.js +0 -1
- package/dist/audit.nondeep.runtime-6MT8p_25.js +0 -831
- package/dist/audit.nondeep.runtime.js +0 -1
- package/dist/audit.runtime-jdG0-1Bq.js +0 -7
- package/dist/audit.runtime.js +0 -1
- package/dist/auth-CmL8nlqP.js +0 -371
- package/dist/auth-Zya_1BCc.js +0 -181
- package/dist/auth-choice-CSSk-2VN.js +0 -69
- package/dist/auth-choice-Uyll2O8p.js +0 -341
- package/dist/auth-choice-legacy-5XgU4yCZ.js +0 -44
- package/dist/auth-choice-options-DTRb6fq4.js +0 -98
- package/dist/auth-choice-prompt-BAQTSD2R.js +0 -36
- package/dist/auth-choice-prompt-D6qkTw8h.js +0 -2
- package/dist/auth-choice-x5Cm9EXp.js +0 -3
- package/dist/auth-choice.apply-helpers-CtKCiOT4.js +0 -2
- package/dist/auth-choice.plugin-providers.runtime-BVH7Kq_W.js +0 -11
- package/dist/auth-choice.plugin-providers.runtime.js +0 -1
- package/dist/auth-health-BBleirOY.js +0 -165
- package/dist/auth-mode-policy-BD7_M2AG.js +0 -18
- package/dist/auth-profiles-B0SpzBJv.js +0 -440
- package/dist/auth-rate-limit-OkMcM1wH.js +0 -119
- package/dist/auth-store-Bro-SY1-.js +0 -242
- package/dist/avatar-policy-pho6U35i.js +0 -67
- package/dist/backend-config-CNAjcjho.js +0 -311
- package/dist/backoff-nvVV-tHk.js +0 -18
- package/dist/backup-create-CkkM1HNg.js +0 -462
- package/dist/backup-health-BWSliymu.js +0 -59
- package/dist/banner-DPWatUan.js +0 -370
- package/dist/banner-lDKgB6uE.js +0 -2
- package/dist/base-session-key-CRSigEPk.js +0 -14
- package/dist/binaries-CWBYavgU.js +0 -2
- package/dist/binaries-sPf-9aLM.js +0 -11
- package/dist/binding-registry-BkSvI4jO.js +0 -520
- package/dist/binding-targets-CdIq3brX.js +0 -99
- package/dist/bindings-AuReyzvX.js +0 -21
- package/dist/bindings-CYhLRcr8.js +0 -69
- package/dist/block-reply-pipeline-GSCCinHx.js +0 -266
- package/dist/block-streaming-4outFa6R.js +0 -107
- package/dist/bluebubbles-CorTCHc9.js +0 -64
- package/dist/bluebubbles-D2WymlOg.js +0 -235
- package/dist/bluebubbles-policy-C3d8eqhQ.js +0 -13
- package/dist/bonjour-cache-cleanup-BZJ-GrdX.js +0 -126
- package/dist/boolean-BEhDlAk_.js +0 -29
- package/dist/boolean-param-B807dWHx.js +0 -13
- package/dist/bot-BM1bybV7.js +0 -4268
- package/dist/bot-message-context-CdedyAq_.js +0 -2
- package/dist/bot-message-context-DKGx6N8p.js +0 -1175
- package/dist/bot-message-context.runtime-ClW1x1V5.js +0 -7
- package/dist/bot-message-context.runtime.js +0 -1
- package/dist/bot-message-context.session.runtime-BWjdkRuf.js +0 -12
- package/dist/bot-message-context.session.runtime.js +0 -1
- package/dist/bot-native-commands.delivery.runtime-CgfbR-Nj.js +0 -3
- package/dist/bot-native-commands.delivery.runtime.js +0 -1
- package/dist/bot-native-commands.runtime-DCz7w0aK.js +0 -11
- package/dist/bot-native-commands.runtime.js +0 -1
- package/dist/boundary-file-read-DB4ibbUg.js +0 -192
- package/dist/brave-web-search-provider-B7m_Mprt.js +0 -441
- package/dist/brew-B9JEV5Jj.js +0 -44
- package/dist/browser-config-D_OlwMzh.js +0 -226
- package/dist/browser-open-C9FOO4U_.js +0 -94
- package/dist/browser-runtime-CnWZ_eLQ.js +0 -185
- package/dist/browser-support-Cdp2Gr_6.js +0 -34
- package/dist/btw-command-CPUGSdlD.js +0 -16
- package/dist/build-info.json +0 -5
- package/dist/bundle-lsp-CCIAK1od.js +0 -93
- package/dist/bundled/boot-md/HOOK.md +0 -20
- package/dist/bundled/boot-md/handler.js +0 -180
- package/dist/bundled/bootstrap-extra-files/HOOK.md +0 -53
- package/dist/bundled/bootstrap-extra-files/handler.js +0 -42
- package/dist/bundled/command-logger/HOOK.md +0 -122
- package/dist/bundled/command-logger/handler.js +0 -56
- package/dist/bundled/session-memory/HOOK.md +0 -108
- package/dist/bundled/session-memory/handler.js +0 -196
- package/dist/bundled/workflow-summary/HOOK.md +0 -123
- package/dist/bundled/workflow-summary/handler.js +0 -115
- package/dist/bundled-capability-metadata-BpPgIy_5.js +0 -40
- package/dist/bundled-compat-BLlVmkDi.js +0 -64
- package/dist/bundled-sources-BQTCt2mJ.js +0 -53
- package/dist/button-types-B3_mzf8P.js +0 -54
- package/dist/cache-controls-DBdT4I-H.js +0 -40
- package/dist/call-dy-GwrXS.js +0 -649
- package/dist/call-ti-nPnzT.js +0 -2
- package/dist/canvas-host/a2ui/.bundle.hash +0 -1
- package/dist/canvas-host/a2ui/a2ui.bundle.js +0 -14896
- package/dist/canvas-host/a2ui/index.html +0 -307
- package/dist/capability-provider-runtime-CFUC5NbJ.js +0 -40
- package/dist/catalog-5PPtilI5.js +0 -274
- package/dist/channel-2EW4xzvV.js +0 -788
- package/dist/channel-BiRtGLF8.js +0 -1135
- package/dist/channel-C3AVw0Nl.js +0 -883
- package/dist/channel-CPe2XmyD.js +0 -1217
- package/dist/channel-CVFWRvjf.js +0 -337
- package/dist/channel-Cs0onQ6d.js +0 -4976
- package/dist/channel-D18v9r53.js +0 -1661
- package/dist/channel-D2n2s8Le.js +0 -208
- package/dist/channel-DWKApPW2.js +0 -454
- package/dist/channel-Depm5C-f.js +0 -800
- package/dist/channel-DwTcZxFU.js +0 -1129
- package/dist/channel-LT5vI3EK.js +0 -361
- package/dist/channel-XgThIGmf.js +0 -698
- package/dist/channel-account-context-CWd3uN_m.js +0 -104
- package/dist/channel-actions-DSvaYD1T.js +0 -39
- package/dist/channel-bQKtZIt6.js +0 -599
- package/dist/channel-catalog.json +0 -3
- package/dist/channel-config-D0eO5f5m.js +0 -115
- package/dist/channel-config-helpers-CLFL8FLU.js +0 -482
- package/dist/channel-config-primitives-DwsP66Ak.js +0 -3
- package/dist/channel-config-schema-DsguzRfd.js +0 -6
- package/dist/channel-config-writes-DQZOOZZ8.js +0 -1
- package/dist/channel-configured-B6WgvouH.js +0 -108
- package/dist/channel-feedback-DiLm9hqS.js +0 -257
- package/dist/channel-inbound-CXD3aSAK.js +0 -30
- package/dist/channel-issues-C-49e607.js +0 -13
- package/dist/channel-lifecycle-BnjeZxB6.js +0 -286
- package/dist/channel-lifecycle.core-Cn3zeU0h.js +0 -69
- package/dist/channel-options-DXJ7b7Ye.js +0 -39
- package/dist/channel-pairing-Byr3MFbN.js +0 -68
- package/dist/channel-plugin-common-D2EFcTg8.js +0 -4
- package/dist/channel-plugin-ids-DiOSWlnO.js +0 -56
- package/dist/channel-plugin-resolution-SMHmHx5v.js +0 -144
- package/dist/channel-policy-B-XKjrjK.js +0 -32
- package/dist/channel-reply-pipeline-BtBcBCNu.js +0 -16
- package/dist/channel-resolution-Du3EtWh1.js +0 -60
- package/dist/channel-runtime-F8_51GPp.js +0 -9
- package/dist/channel-selection-Bz3pl14y.js +0 -125
- package/dist/channel-send-result-CyfDCXJG.js +0 -40
- package/dist/channel-setup-yWpuHwhm.js +0 -51
- package/dist/channel-shared-gHcJ8n-f.js +0 -58
- package/dist/channel-status-CyoeLEnj.js +0 -2
- package/dist/channel-summary-5zHt-z1E.js +0 -139
- package/dist/channel-summary-B_fbXZ3l.js +0 -2
- package/dist/channel-target-DHO43h-I.js +0 -157
- package/dist/channel-targets-C8ZPfJmV.js +0 -18
- package/dist/channel-y-bXwYi3.js +0 -783
- package/dist/channel.runtime-B2SEUCf0.js +0 -14
- package/dist/channel.runtime-BF5qdBeA.js +0 -5
- package/dist/channel.runtime-BPaq6EO_.js +0 -108
- package/dist/channel.runtime-BV8FGxyb.js +0 -373
- package/dist/channel.runtime-CGnamSTC.js +0 -125
- package/dist/channel.runtime-CRNf20Ct.js +0 -80
- package/dist/channel.runtime-CRSWVexY.js +0 -335
- package/dist/channel.runtime-Cg6DmoTp.js +0 -783
- package/dist/channel.runtime-CpHTHeFR.js +0 -309
- package/dist/channel.runtime-ZdhCn8XI.js +0 -3315
- package/dist/channel.runtime-cXufT2kW.js +0 -61
- package/dist/channel.runtime.js +0 -1
- package/dist/channel.setup-Bq1vgxXZ.js +0 -279
- package/dist/channels-BZC2kp_G.js +0 -409
- package/dist/channels-CMeYB3bY.js +0 -1134
- package/dist/channels-cli-BIzqRmuu.js +0 -246
- package/dist/channels-status-issues-DqTdy1lq.js +0 -17
- package/dist/chat-envelope-DlGbh8k2.js +0 -158
- package/dist/chat-meta-wVbKo1sw.js +0 -700
- package/dist/chat-target-prefixes-DCF8a_Lp.js +0 -156
- package/dist/chat-type-DXjGtE-S.js +0 -10
- package/dist/chunk-CW-a7Cfh.js +0 -334
- package/dist/chunk-CrysgU_F.js +0 -36
- package/dist/chutes-oauth-Bh3BTMMG.js +0 -127
- package/dist/cjk-chars-Dl_Ko7yI.js +0 -50
- package/dist/clack-prompter-C5PtKpUH.js +0 -112
- package/dist/clawbot-cli-CgHyabtp.js +0 -9
- package/dist/clawhub-CDs2LE11.js +0 -263
- package/dist/clawhub-CO6YnoQZ.js +0 -163
- package/dist/cli/daemon-cli.js +0 -9
- package/dist/cli-CoOwN-V4.js +0 -164
- package/dist/cli-CpOL_jWZ.js +0 -152
- package/dist/cli-DCp06hI2.js +0 -2
- package/dist/cli-DVSDSUQm.js +0 -695
- package/dist/cli-backend-B20k67rv.js +0 -44
- package/dist/cli-backend-CcuyEMrq.js +0 -1
- package/dist/cli-backend-DMTxL8mq.js +0 -40
- package/dist/cli-backend-M4CTb3mq.js +0 -49
- package/dist/cli-migration-BwqQvUer.js +0 -100
- package/dist/cli-name-C3PA6Rhs.js +0 -21
- package/dist/cli-runner-8SNo1pKS.js +0 -1014
- package/dist/cli-runtime-ChUqI2f-.js +0 -3
- package/dist/cli-shared-01J1LZRE.js +0 -72
- package/dist/cli-startup-metadata.json +0 -14
- package/dist/cli-utils-eYXt_xAg.js +0 -40
- package/dist/cli-watchdog-defaults-Dff-MFUz.js +0 -14
- package/dist/cli.runtime-WWGaX6X6.js +0 -547
- package/dist/cli.runtime.js +0 -1
- package/dist/client-BFxjGELJ.js +0 -5
- package/dist/client-C8_DsF-r.js +0 -7
- package/dist/client-bootstrap-BiVps8T6.js +0 -2
- package/dist/client-bootstrap-CFGCltAu.js +0 -121
- package/dist/client-lEilgam1.js +0 -87
- package/dist/cmd-argv-BbyQhzAC.js +0 -68
- package/dist/code-execution-CPcuE0sX.js +0 -142
- package/dist/codex-native-web-search-CyrsDBZ2.js +0 -155
- package/dist/codex-native-web-search-PFJu8fcM.js +0 -2
- package/dist/collection-runtime-DJjFReXJ.js +0 -1
- package/dist/command-auth-BAkZv3cP.js +0 -356
- package/dist/command-auth-native-Bsp5Doyd.js +0 -3
- package/dist/command-auth-tqFmaIaJ.js +0 -64
- package/dist/command-detection-BV7Ipg_0.js +0 -49
- package/dist/command-detection-DyqWl5Nq.js +0 -2
- package/dist/command-format-CX1xXtgB.js +0 -22
- package/dist/command-format-DwYoemR9.js +0 -2
- package/dist/command-gating-NyDk7t84.js +0 -40
- package/dist/command-options-BUoAEXAi.js +0 -25
- package/dist/command-poll-backoff-B7RiSvcV.js +0 -56
- package/dist/command-poll-backoff.runtime-DX9gobB0.js +0 -7
- package/dist/command-poll-backoff.runtime.js +0 -1
- package/dist/command-queue-CxEmvSGT.js +0 -253
- package/dist/command-registry-CaJXKNoO.js +0 -3
- package/dist/command-registry-Ct0qor9d.js +0 -199
- package/dist/command-secret-gateway-43O-1Hnf.js +0 -2
- package/dist/command-secret-gateway-C39SFGHd.js +0 -442
- package/dist/command-secret-targets-Bns-l1xV.js +0 -2
- package/dist/command-secret-targets-CTrFghcj.js +0 -87
- package/dist/command-surface-CfP1vask.js +0 -2
- package/dist/commands/status.summary.runtime.js +0 -146
- package/dist/commands-BxWe27p0.js +0 -42
- package/dist/commands-CiyPyNRY.js +0 -194
- package/dist/commands-acp-BeCm2Wnq.js +0 -990
- package/dist/commands-context-DbfMrVv4.js +0 -33
- package/dist/commands-core-CEmQydIV.js +0 -241
- package/dist/commands-core.runtime-BYooAQbc.js +0 -2
- package/dist/commands-core.runtime.js +0 -1
- package/dist/commands-handlers.runtime-CEAP4Yv2.js +0 -3707
- package/dist/commands-handlers.runtime.js +0 -1
- package/dist/commands-info-COwAtIWb.js +0 -651
- package/dist/commands-models-B4EJh5Fy.js +0 -395
- package/dist/commands-o21Y9Xck.js +0 -4
- package/dist/commands-registry-DgMc5_jk.js +0 -295
- package/dist/commands-registry.data-5O2FOeZl.js +0 -935
- package/dist/commands-registry.runtime-CT_YXpwM.js +0 -2
- package/dist/commands-registry.runtime.js +0 -1
- package/dist/commands-status.runtime-D4F4iVUh.js +0 -2
- package/dist/commands-status.runtime.js +0 -1
- package/dist/commands.runtime-_ALsMFcS.js +0 -4
- package/dist/commands.runtime.js +0 -1
- package/dist/common-Dbmo0I1E.js +0 -206
- package/dist/compact.runtime-CBfyBJbR.js +0 -7
- package/dist/compact.runtime.js +0 -1
- package/dist/completion-cli-COhEd9CF.js +0 -2
- package/dist/completion-cli-DHe4Rit5.js +0 -466
- package/dist/components-CamLdbbq.js +0 -797
- package/dist/components-DPbtLC3x.js +0 -2
- package/dist/config-CKJA2kAO.js +0 -53
- package/dist/config-D7-9dK3i.js +0 -138
- package/dist/config-DJ29sg5U.js +0 -475
- package/dist/config-DJNI2tTK.js +0 -136
- package/dist/config-Dr2GRT3y.js +0 -135
- package/dist/config-DsqKYjeo.js +0 -421
- package/dist/config-Q9kc32gz.js +0 -41
- package/dist/config-RUefx-_1.js +0 -8
- package/dist/config-cli-BqlYHmPA.js +0 -945
- package/dist/config-error-handler-BKRR0_j_.js +0 -197
- package/dist/config-error-handler-CT1igiX6.js +0 -2
- package/dist/config-eval-hTWq4IVy.js +0 -100
- package/dist/config-guard-Bk3_wSTH.js +0 -113
- package/dist/config-helpers-DLVbtn1B.js +0 -117
- package/dist/config-paths-BKYh__Ga.js +0 -8
- package/dist/config-paths-DP5yXXo2.js +0 -102
- package/dist/config-presence-omlqvhAQ.js +0 -79
- package/dist/config-regex-CvZFnWkO.js +0 -39
- package/dist/config-runtime-ngoccXmP.js +0 -13
- package/dist/config-schema-B3sQY5B_.js +0 -133
- package/dist/config-schema-B_2MhEQY.js +0 -71
- package/dist/config-schema-BpIXBNbc.js +0 -202
- package/dist/config-schema-BtfQOmdV.js +0 -115
- package/dist/config-schema-Bw-Xbo_T.js +0 -85
- package/dist/config-schema-Cqj-Mugi.js +0 -105
- package/dist/config-schema-DQSj_ZL_.js +0 -29
- package/dist/config-schema-Pe1Vn9kb.js +0 -17
- package/dist/config-schema-f7nntJMh.js +0 -25
- package/dist/config-schema-lBqODOnr.js +0 -25
- package/dist/config-schema-mfJ91WLf.js +0 -65
- package/dist/config-secret-input.runtime-B_HyRtgE.js +0 -3
- package/dist/config-secret-input.runtime.js +0 -1
- package/dist/config-state-DfIk9ME6.js +0 -289
- package/dist/config-status-Bnobp1-p.js +0 -2
- package/dist/config-status-Db93sFQB.js +0 -109
- package/dist/config-update-B_S0YQ_Y.js +0 -3
- package/dist/config-update-CK4EDDeD.js +0 -127
- package/dist/config-validation-Bh_sg7RW.js +0 -276
- package/dist/config-value-CMTdBw5q.js +0 -25
- package/dist/configure-CGDY1YR7.js +0 -1140
- package/dist/configure-V8jejRHr.js +0 -2
- package/dist/configured-provider-fallback-DWYDg0L7.js +0 -15
- package/dist/connection-auth-CKM60o55.js +0 -30
- package/dist/connection-details-DyVOoGG6.js +0 -56
- package/dist/constants-Bq55qi82.js +0 -71
- package/dist/constants-CimYBSye.js +0 -4
- package/dist/content-blocks-DuKJNUtm.js +0 -785
- package/dist/context-D-9a98Zk.js +0 -227
- package/dist/context-visibility-DTMZdcAH.js +0 -14
- package/dist/context-visibility-vOvLMUrZ.js +0 -35
- package/dist/context-window-guard-WE0ENAeQ.js +0 -46
- package/dist/control-ui-assets-DVYAF-2p.js +0 -240
- package/dist/control-ui-shared-BKXkFsA7.js +0 -29
- package/dist/conversation-binding-C2nuZ3Eg.js +0 -520
- package/dist/conversation-binding-input-CBwdWDC4.js +0 -250
- package/dist/conversation-bindings-Cq4z4vhr.js +0 -210
- package/dist/conversation-id-4JeHag0a.js +0 -168
- package/dist/conversation-id-CXuzm-Ub.js +0 -116
- package/dist/conversation-id-DCTwJCZF.js +0 -43
- package/dist/conversation-label-C2xTELop.js +0 -32
- package/dist/conversation-runtime-bArk0IjJ.js +0 -85
- package/dist/core-DaMVvavf.js +0 -195
- package/dist/core-api-D0U2iGRK.js +0 -670
- package/dist/core-command-descriptors-DxRm2H1p.js +0 -91
- package/dist/create-client-BOKOxyiu.js +0 -58
- package/dist/create-client-Bzn467Jo.js +0 -2
- package/dist/credentials-BGPs1gIX.js +0 -242
- package/dist/credentials-DUoYFiLk.js +0 -22
- package/dist/credentials-read-CDYtvkBt.js +0 -74
- package/dist/credentials-read-KB395CbD.js +0 -2
- package/dist/credentials-write.runtime-Bx7mKj4E.js +0 -9
- package/dist/credentials-write.runtime.js +0 -1
- package/dist/creds-files-CTtTs6zG.js +0 -19
- package/dist/cron-cli-Di3TakVa.js +0 -644
- package/dist/crypto-node.runtime-DI0fQ6wI.js +0 -5
- package/dist/crypto-node.runtime.js +0 -1
- package/dist/crypto-runtime-Bc-jKPlv.js +0 -1036
- package/dist/current-time--aIDbABZ.js +0 -20
- package/dist/daemon-cli-Cnry1ft1.js +0 -370
- package/dist/daemon-install-de_bWPuS.js +0 -63
- package/dist/daemon-install-plan.shared-u00bwv47.js +0 -222
- package/dist/daemon-runtime-DPejcJWG.js +0 -12
- package/dist/dangerous-name-matching-DnCDaXzP.js +0 -48
- package/dist/dangerous-name-runtime-Dinw00TZ.js +0 -1
- package/dist/dangerous-tools-C3RlQe7u.js +0 -38
- package/dist/date-time-DRQ0-oaw.js +0 -118
- package/dist/ddg-search-provider-B0zLjcDN.js +0 -182
- package/dist/dedupe-DZbQYOSD.js +0 -59
- package/dist/default-account-warnings-BCrmijcz.js +0 -15
- package/dist/default-models-Br0v8QOH.js +0 -35
- package/dist/defaults-DAt--D9n.js +0 -6
- package/dist/defaults-D_Y_lvUP.js +0 -7
- package/dist/defaults-MkMfnGzi.js +0 -7
- package/dist/delegate-CLP7zDS_.js +0 -43
- package/dist/deliver-CIUEKe4q.js +0 -954
- package/dist/deliver-LN-Yg8wS.js +0 -3
- package/dist/deliver-reply-DL-CSF43.js +0 -238
- package/dist/deliver-runtime-CoqXhxlS.js +0 -2
- package/dist/delivery-CL_3vFSl.js +0 -834
- package/dist/delivery-context-CoAL-jTI.js +0 -106
- package/dist/delivery-info-DTAUApso.js +0 -40
- package/dist/delivery-queue-DBW69jH4.js +0 -2
- package/dist/delivery-queue-DMubgaLa.js +0 -289
- package/dist/deps-34N0Nmbl.js +0 -67
- package/dist/deps-BVogrCia.js +0 -2
- package/dist/deps-DZJpA4XG.js +0 -153
- package/dist/detect-Zrcrs8SP.js +0 -12
- package/dist/detect-binary-CEX186X6.js +0 -30
- package/dist/device-auth-D_0GUMYY.js +0 -19
- package/dist/device-bootstrap-Bnn4K3fQ.js +0 -3
- package/dist/device-bootstrap-bwpHYQhY.js +0 -176
- package/dist/device-health-B3q7Cmqn.js +0 -2
- package/dist/device-health-DhmPD0gq.js +0 -16
- package/dist/device-identity-Cak311si.js +0 -2
- package/dist/device-identity-Doxo0HJx.js +0 -140
- package/dist/device-metadata-normalization-B5_zplC_.js +0 -21
- package/dist/device-pairing-BCpR-Vtb.js +0 -520
- package/dist/devices-cli-DYPkfzsG.js +0 -328
- package/dist/diagnostic-DfKz60Xk.js +0 -311
- package/dist/diagnostic-events-CUSmY-rn.js +0 -48
- package/dist/diagnostic-flags-DLDDycUv.js +0 -64
- package/dist/diagnostic-runtime-ZQC4AswI.js +0 -1
- package/dist/diagnostics-Cxl1bFGj.js +0 -33
- package/dist/diagnostics-GjF7wpY9.js +0 -2
- package/dist/diagnostics-otel-C2RQUlQT.js +0 -3
- package/dist/diffs-DsHt689X.js +0 -2
- package/dist/direct-dm-ByuWacLn.js +0 -139
- package/dist/direct-management-DEtuCcDL.js +0 -2
- package/dist/direct-management-DMp7MOnt.js +0 -300
- package/dist/direct-room-ARYWsCbX.js +0 -2
- package/dist/direct-room-DYlSJOU_.js +0 -67
- package/dist/directive-handling.defaults-BMh2DXTA.js +0 -19
- package/dist/directive-handling.fast-lane-CBX4jbax.js +0 -2
- package/dist/directive-handling.fast-lane-DRvycpgg.js +0 -64
- package/dist/directive-handling.impl-BKJf5Ltu.js +0 -672
- package/dist/directive-handling.impl-BkdGnm-T.js +0 -2
- package/dist/directive-handling.levels-BHOBnnn8.js +0 -2
- package/dist/directive-handling.levels-CecoBNlK.js +0 -12
- package/dist/directive-handling.parse-BuTiWmrT.js +0 -375
- package/dist/directive-handling.persist-D9RYevoA.js +0 -133
- package/dist/directive-handling.persist.runtime-Cb_unTVH.js +0 -2
- package/dist/directive-handling.persist.runtime.js +0 -1
- package/dist/directive-handling.shared-_Zvt3-ej.js +0 -158
- package/dist/directive-tags-Cm0H6Dn_.js +0 -109
- package/dist/directives-f-UxcP8D.js +0 -209
- package/dist/directory-cache-CM_EUchr.js +0 -62
- package/dist/directory-cli-D6N59tzr.js +0 -238
- package/dist/directory-config-helpers-BCrssKbI.js +0 -141
- package/dist/directory-runtime-CAabZ_XW.js +0 -20
- package/dist/directory.static-TKo2MeNR.js +0 -45
- package/dist/discord-BOpl5w4U.js +0 -5
- package/dist/discord-account-wyFuLDq_.js +0 -11
- package/dist/discord-core-BpzKxDZ7.js +0 -5
- package/dist/discord-lOPvIxp4.js +0 -11
- package/dist/discord-runtime-surface-Dm5WUtCV.js +0 -67
- package/dist/discord-session-key-DaPto1yr.js +0 -11
- package/dist/discord-surface-Cg_Mu9MI.js +0 -30
- package/dist/discord-thread-bindings-zIOp1Tj4.js +0 -29
- package/dist/discord-timeouts-Di5n5LAU.js +0 -12
- package/dist/discovery-DLbFJLD_.js +0 -171
- package/dist/dispatch-C4gGGYZt.js +0 -858
- package/dist/dispatch-acp.runtime-DUHj6bP-.js +0 -884
- package/dist/dispatch-acp.runtime.js +0 -1
- package/dist/dist-7JNqoGV7.js +0 -3
- package/dist/dist-BqJPEiV8.js +0 -14245
- package/dist/dist-DdE56Pmi.js +0 -503
- package/dist/dist-shQCTuJB.js +0 -1239
- package/dist/dm-policy-shared-C99GNVxp.js +0 -188
- package/dist/dns-cli-vQBAzTmg.js +0 -192
- package/dist/docker-BN7sQKCb.js +0 -789
- package/dist/docs-cli-Br6cfKoS.js +0 -156
- package/dist/doctor-completion-Cf0GcTXR.js +0 -90
- package/dist/doctor-config-preflight-C2cKYiKe.js +0 -2
- package/dist/doctor-config-preflight-DNbO-_N8.js +0 -148
- package/dist/doctor-state-migrations-BXkbeSFy.js +0 -2
- package/dist/doctor-state-migrations-G3shZ-W_.js +0 -3
- package/dist/dotenv-CelghjA4.js +0 -11
- package/dist/dotenv-Csg1Xj8n.js +0 -113
- package/dist/embedding-provider-Aey9VsDb.js +0 -129
- package/dist/enable-BgSxsKp_.js +0 -57
- package/dist/encryption-guidance-62xAQFP4.js +0 -33
- package/dist/entry-status-3ymZYX2l.js +0 -172
- package/dist/entry.js +0 -209
- package/dist/env-CK3eZNIX.js +0 -40
- package/dist/env-overrides-CcDOWo0Y.js +0 -346
- package/dist/env-overrides.runtime-CKb7-Q72.js +0 -7
- package/dist/env-overrides.runtime.js +0 -1
- package/dist/env-substitution-UhJwb0ys.js +0 -136
- package/dist/envelope-CrC9AdBL.js +0 -137
- package/dist/error-runtime-D-gKufd_.js +0 -2
- package/dist/error-text-BC9WfvfX.js +0 -24
- package/dist/errors-Bs2h5H8p.js +0 -71
- package/dist/errors-CjFsF-QY.js +0 -9
- package/dist/exa-web-search-provider-DUUlmDcV.js +0 -355
- package/dist/exec-BO6vYjRf.js +0 -368
- package/dist/exec-CD7C9g-b.js +0 -2
- package/dist/exec-approval-reply-CFOEcmIv.js +0 -189
- package/dist/exec-approval-session-target-BbsAlD1Q.js +0 -159
- package/dist/exec-approvals-3UDrE7Q9.js +0 -1565
- package/dist/exec-approvals-CW5axvaY.js +0 -121
- package/dist/exec-approvals-cli-BPYvtJv-.js +0 -483
- package/dist/exec-approvals-effective-DbLJfkpe.js +0 -140
- package/dist/exec-safe-bin-runtime-policy-218hHVyc.js +0 -90
- package/dist/exec-safety-XzKkUSvE.js +0 -24
- package/dist/export-html/template.css +0 -1060
- package/dist/export-html/template.html +0 -88
- package/dist/export-html/template.js +0 -1875
- package/dist/export-html/vendor/highlight.min.js +0 -1213
- package/dist/export-html/vendor/marked.min.js +0 -6
- package/dist/extension-shared-V_4IXpRU.js +0 -74
- package/dist/extensionAPI.js +0 -17
- package/dist/extensions/acpx/index.js +0 -1855
- package/dist/extensions/acpx/mcp-proxy.mjs +0 -151
- package/dist/extensions/acpx/openclaw.plugin.json +0 -132
- package/dist/extensions/acpx/package.json +0 -14
- package/dist/extensions/acpx/runtime-api.js +0 -5
- package/dist/extensions/acpx/skills/acp-router/SKILL.md +0 -245
- package/dist/extensions/aicq-chat/index.js +0 -284
- package/dist/extensions/aicq-chat/openclaw.plugin.json +0 -30
- package/dist/extensions/amazon-bedrock/api.js +0 -3
- package/dist/extensions/amazon-bedrock/discovery.js +0 -2
- package/dist/extensions/amazon-bedrock/index.js +0 -65
- package/dist/extensions/amazon-bedrock/openclaw.plugin.json +0 -44
- package/dist/extensions/amazon-bedrock/package.json +0 -23
- package/dist/extensions/anthropic/api.js +0 -3
- package/dist/extensions/anthropic/cli-backend.js +0 -2
- package/dist/extensions/anthropic/cli-migration.js +0 -2
- package/dist/extensions/anthropic/cli-shared.js +0 -2
- package/dist/extensions/anthropic/index.js +0 -357
- package/dist/extensions/anthropic/media-understanding-provider.js +0 -2
- package/dist/extensions/anthropic/openclaw.plugin.json +0 -64
- package/dist/extensions/anthropic/package.json +0 -12
- package/dist/extensions/anthropic/stream-wrappers.js +0 -2
- package/dist/extensions/anthropic/test-api.js +0 -2
- package/dist/extensions/anthropic-vertex/api.js +0 -4
- package/dist/extensions/anthropic-vertex/index.js +0 -36
- package/dist/extensions/anthropic-vertex/openclaw.plugin.json +0 -12
- package/dist/extensions/anthropic-vertex/package.json +0 -12
- package/dist/extensions/anthropic-vertex/provider-catalog.js +0 -2
- package/dist/extensions/anthropic-vertex/region.js +0 -2
- package/dist/extensions/bluebubbles/api.js +0 -5
- package/dist/extensions/bluebubbles/channel-config-api.js +0 -2
- package/dist/extensions/bluebubbles/index.js +0 -13
- package/dist/extensions/bluebubbles/openclaw.plugin.json +0 -11
- package/dist/extensions/bluebubbles/package.json +0 -48
- package/dist/extensions/bluebubbles/runtime-api.js +0 -2
- package/dist/extensions/bluebubbles/setup-entry.js +0 -26
- package/dist/extensions/brave/index.js +0 -13
- package/dist/extensions/brave/openclaw.plugin.json +0 -50
- package/dist/extensions/brave/package.json +0 -12
- package/dist/extensions/brave/test-api.js +0 -2
- package/dist/extensions/brave/web-search-provider.js +0 -2
- package/dist/extensions/browser/browser-runtime-api.js +0 -4
- package/dist/extensions/browser/index.js +0 -20
- package/dist/extensions/browser/openclaw.plugin.json +0 -9
- package/dist/extensions/browser/package.json +0 -12
- package/dist/extensions/browser/runtime-api.js +0 -6
- package/dist/extensions/browser/test-support.js +0 -50
- package/dist/extensions/byteplus/api.js +0 -3
- package/dist/extensions/byteplus/index.js +0 -63
- package/dist/extensions/byteplus/models.js +0 -2
- package/dist/extensions/byteplus/openclaw.plugin.json +0 -33
- package/dist/extensions/byteplus/package.json +0 -12
- package/dist/extensions/byteplus/provider-catalog.js +0 -2
- package/dist/extensions/chutes/api.js +0 -3
- package/dist/extensions/chutes/index.js +0 -143
- package/dist/extensions/chutes/models.js +0 -2
- package/dist/extensions/chutes/onboard.js +0 -3
- package/dist/extensions/chutes/openclaw.plugin.json +0 -44
- package/dist/extensions/chutes/package.json +0 -12
- package/dist/extensions/chutes/provider-catalog.js +0 -2
- package/dist/extensions/cloudflare-ai-gateway/api.js +0 -3
- package/dist/extensions/cloudflare-ai-gateway/index.js +0 -188
- package/dist/extensions/cloudflare-ai-gateway/models.js +0 -2
- package/dist/extensions/cloudflare-ai-gateway/onboard.js +0 -2
- package/dist/extensions/cloudflare-ai-gateway/openclaw.plugin.json +0 -33
- package/dist/extensions/cloudflare-ai-gateway/package.json +0 -12
- package/dist/extensions/copilot-proxy/index.js +0 -125
- package/dist/extensions/copilot-proxy/openclaw.plugin.json +0 -27
- package/dist/extensions/copilot-proxy/package.json +0 -12
- package/dist/extensions/copilot-proxy/runtime-api.js +0 -3
- package/dist/extensions/deepgram/audio.js +0 -2
- package/dist/extensions/deepgram/index.js +0 -13
- package/dist/extensions/deepgram/media-understanding-provider.js +0 -2
- package/dist/extensions/deepgram/openclaw.plugin.json +0 -13
- package/dist/extensions/deepgram/package.json +0 -12
- package/dist/extensions/deepseek/api.js +0 -3
- package/dist/extensions/deepseek/index.js +0 -33
- package/dist/extensions/deepseek/models.js +0 -2
- package/dist/extensions/deepseek/onboard.js +0 -2
- package/dist/extensions/deepseek/openclaw.plugin.json +0 -32
- package/dist/extensions/deepseek/package.json +0 -12
- package/dist/extensions/deepseek/provider-catalog.js +0 -2
- package/dist/extensions/device-pair/api.js +0 -10
- package/dist/extensions/device-pair/index.js +0 -483
- package/dist/extensions/device-pair/notify.js +0 -2
- package/dist/extensions/device-pair/openclaw.plugin.json +0 -21
- package/dist/extensions/device-pair/qr-image.js +0 -3
- package/dist/extensions/diagnostics-otel/api.js +0 -6
- package/dist/extensions/diagnostics-otel/index.js +0 -485
- package/dist/extensions/diagnostics-otel/openclaw.plugin.json +0 -8
- package/dist/extensions/diagnostics-otel/package.json +0 -27
- package/dist/extensions/diffs/api.js +0 -4
- package/dist/extensions/diffs/assets/viewer-runtime.js +0 -1888
- package/dist/extensions/diffs/index.js +0 -2058
- package/dist/extensions/diffs/openclaw.plugin.json +0 -226
- package/dist/extensions/diffs/package.json +0 -24
- package/dist/extensions/diffs/runtime-api.js +0 -3
- package/dist/extensions/diffs/skills/diffs/SKILL.md +0 -23
- package/dist/extensions/discord/action-runtime-api.js +0 -2
- package/dist/extensions/discord/api.js +0 -14
- package/dist/extensions/discord/channel-config-api.js +0 -2
- package/dist/extensions/discord/index.js +0 -612
- package/dist/extensions/discord/openclaw.plugin.json +0 -11
- package/dist/extensions/discord/package.json +0 -52
- package/dist/extensions/discord/runtime-api.js +0 -230
- package/dist/extensions/discord/session-key-api.js +0 -2
- package/dist/extensions/discord/setup-entry.js +0 -10
- package/dist/extensions/discord/test-api.js +0 -45
- package/dist/extensions/discord/timeouts.js +0 -2
- package/dist/extensions/duckduckgo/index.js +0 -13
- package/dist/extensions/duckduckgo/openclaw.plugin.json +0 -41
- package/dist/extensions/duckduckgo/package.json +0 -12
- package/dist/extensions/duckduckgo/web-search-provider.js +0 -2
- package/dist/extensions/elevenlabs/index.js +0 -13
- package/dist/extensions/elevenlabs/openclaw.plugin.json +0 -13
- package/dist/extensions/elevenlabs/package.json +0 -12
- package/dist/extensions/elevenlabs/speech-provider.js +0 -2
- package/dist/extensions/elevenlabs/test-api.js +0 -2
- package/dist/extensions/elevenlabs/tts.js +0 -2
- package/dist/extensions/exa/index.js +0 -13
- package/dist/extensions/exa/openclaw.plugin.json +0 -39
- package/dist/extensions/exa/package.json +0 -12
- package/dist/extensions/exa/web-search-provider.js +0 -2
- package/dist/extensions/fal/image-generation-provider.js +0 -2
- package/dist/extensions/fal/index.js +0 -45
- package/dist/extensions/fal/onboard.js +0 -2
- package/dist/extensions/fal/openclaw.plugin.json +0 -40
- package/dist/extensions/fal/package.json +0 -12
- package/dist/extensions/feishu/api.js +0 -7
- package/dist/extensions/feishu/index.js +0 -2531
- package/dist/extensions/feishu/openclaw.plugin.json +0 -14
- package/dist/extensions/feishu/package.json +0 -52
- package/dist/extensions/feishu/runtime-api.js +0 -34
- package/dist/extensions/feishu/session-key-api.js +0 -2
- package/dist/extensions/feishu/setup-api.js +0 -2
- package/dist/extensions/feishu/setup-entry.js +0 -6
- package/dist/extensions/feishu/skills/feishu-doc/SKILL.md +0 -211
- package/dist/extensions/feishu/skills/feishu-doc/references/block-types.md +0 -103
- package/dist/extensions/feishu/skills/feishu-drive/SKILL.md +0 -97
- package/dist/extensions/feishu/skills/feishu-perm/SKILL.md +0 -119
- package/dist/extensions/feishu/skills/feishu-wiki/SKILL.md +0 -111
- package/dist/extensions/firecrawl/api.js +0 -33
- package/dist/extensions/firecrawl/index.js +0 -184
- package/dist/extensions/firecrawl/openclaw.plugin.json +0 -87
- package/dist/extensions/firecrawl/package.json +0 -12
- package/dist/extensions/firecrawl/web-search-provider.js +0 -2
- package/dist/extensions/github-copilot/api.js +0 -2
- package/dist/extensions/github-copilot/index.js +0 -138
- package/dist/extensions/github-copilot/login.js +0 -2
- package/dist/extensions/github-copilot/models-defaults.js +0 -38
- package/dist/extensions/github-copilot/models.js +0 -2
- package/dist/extensions/github-copilot/openclaw.plugin.json +0 -31
- package/dist/extensions/github-copilot/package.json +0 -12
- package/dist/extensions/github-copilot/token.js +0 -3
- package/dist/extensions/github-copilot/usage.js +0 -2
- package/dist/extensions/google/api.js +0 -3
- package/dist/extensions/google/cli-backend.js +0 -2
- package/dist/extensions/google/gemini-cli-provider.js +0 -110
- package/dist/extensions/google/google-shared.test-helpers.js +0 -92
- package/dist/extensions/google/image-generation-provider.js +0 -162
- package/dist/extensions/google/index.js +0 -213
- package/dist/extensions/google/media-understanding-provider.js +0 -104
- package/dist/extensions/google/model-id.js +0 -2
- package/dist/extensions/google/oauth.credentials.js +0 -2
- package/dist/extensions/google/oauth.flow.js +0 -2
- package/dist/extensions/google/oauth.http.js +0 -2
- package/dist/extensions/google/oauth.js +0 -3
- package/dist/extensions/google/oauth.project.js +0 -2
- package/dist/extensions/google/oauth.runtime.js +0 -2
- package/dist/extensions/google/oauth.shared.js +0 -2
- package/dist/extensions/google/oauth.token.js +0 -2
- package/dist/extensions/google/openclaw.plugin.json +0 -89
- package/dist/extensions/google/package.json +0 -12
- package/dist/extensions/google/provider-models.js +0 -2
- package/dist/extensions/google/runtime-api.js +0 -4
- package/dist/extensions/google/test-api.js +0 -2
- package/dist/extensions/google/web-search-provider.js +0 -2
- package/dist/extensions/googlechat/api.js +0 -2
- package/dist/extensions/googlechat/channel-config-api.js +0 -7
- package/dist/extensions/googlechat/index.js +0 -13
- package/dist/extensions/googlechat/openclaw.plugin.json +0 -11
- package/dist/extensions/googlechat/package.json +0 -48
- package/dist/extensions/googlechat/runtime-api.js +0 -39
- package/dist/extensions/googlechat/setup-entry.js +0 -6
- package/dist/extensions/googlechat/test-api.js +0 -3
- package/dist/extensions/groq/index.js +0 -13
- package/dist/extensions/groq/media-understanding-provider.js +0 -2
- package/dist/extensions/groq/openclaw.plugin.json +0 -13
- package/dist/extensions/groq/package.json +0 -12
- package/dist/extensions/huggingface/api.js +0 -4
- package/dist/extensions/huggingface/index.js +0 -54
- package/dist/extensions/huggingface/models.js +0 -2
- package/dist/extensions/huggingface/onboard.js +0 -2
- package/dist/extensions/huggingface/openclaw.plugin.json +0 -34
- package/dist/extensions/huggingface/package.json +0 -12
- package/dist/extensions/huggingface/provider-catalog.js +0 -3
- package/dist/extensions/imessage/api.js +0 -4
- package/dist/extensions/imessage/channel-config-api.js +0 -2
- package/dist/extensions/imessage/index.js +0 -211
- package/dist/extensions/imessage/openclaw.plugin.json +0 -11
- package/dist/extensions/imessage/package.json +0 -26
- package/dist/extensions/imessage/runtime-api.js +0 -11
- package/dist/extensions/imessage/setup-entry.js +0 -13
- package/dist/extensions/irc/api.js +0 -2
- package/dist/extensions/irc/channel-config-api.js +0 -2
- package/dist/extensions/irc/index.js +0 -12
- package/dist/extensions/irc/openclaw.plugin.json +0 -11
- package/dist/extensions/irc/package.json +0 -28
- package/dist/extensions/irc/setup-entry.js +0 -6
- package/dist/extensions/kilocode/api.js +0 -3
- package/dist/extensions/kilocode/index.js +0 -37
- package/dist/extensions/kilocode/onboard.js +0 -3
- package/dist/extensions/kilocode/openclaw.plugin.json +0 -33
- package/dist/extensions/kilocode/package.json +0 -12
- package/dist/extensions/kilocode/provider-catalog.js +0 -2
- package/dist/extensions/kilocode/provider-models.js +0 -2
- package/dist/extensions/kilocode/shared.js +0 -2
- package/dist/extensions/kimi-coding/api.js +0 -3
- package/dist/extensions/kimi-coding/index.js +0 -81
- package/dist/extensions/kimi-coding/onboard.js +0 -2
- package/dist/extensions/kimi-coding/openclaw.plugin.json +0 -38
- package/dist/extensions/kimi-coding/package.json +0 -12
- package/dist/extensions/kimi-coding/provider-catalog.js +0 -2
- package/dist/extensions/kimi-coding/stream.js +0 -2
- package/dist/extensions/line/api.js +0 -13
- package/dist/extensions/line/index.js +0 -815
- package/dist/extensions/line/openclaw.plugin.json +0 -11
- package/dist/extensions/line/package.json +0 -41
- package/dist/extensions/line/runtime-api.js +0 -11
- package/dist/extensions/line/setup-api.js +0 -3
- package/dist/extensions/line/setup-entry.js +0 -15
- package/dist/extensions/litellm/api.js +0 -2
- package/dist/extensions/litellm/index.js +0 -36
- package/dist/extensions/litellm/onboard.js +0 -2
- package/dist/extensions/litellm/openclaw.plugin.json +0 -33
- package/dist/extensions/litellm/package.json +0 -12
- package/dist/extensions/litellm/provider-catalog.js +0 -2
- package/dist/extensions/llm-task/api.js +0 -6
- package/dist/extensions/llm-task/index.js +0 -156
- package/dist/extensions/llm-task/openclaw.plugin.json +0 -33
- package/dist/extensions/llm-task/package.json +0 -16
- package/dist/extensions/lobster/index.js +0 -232
- package/dist/extensions/lobster/openclaw.plugin.json +0 -10
- package/dist/extensions/lobster/package.json +0 -17
- package/dist/extensions/lobster/runtime-api.js +0 -4
- package/dist/extensions/matrix/api.js +0 -10
- package/dist/extensions/matrix/helper-api.js +0 -3
- package/dist/extensions/matrix/index.js +0 -44
- package/dist/extensions/matrix/legacy-crypto-inspector.js +0 -41
- package/dist/extensions/matrix/openclaw.plugin.json +0 -11
- package/dist/extensions/matrix/package.json +0 -53
- package/dist/extensions/matrix/plugin-entry.handlers.runtime.js +0 -48
- package/dist/extensions/matrix/runtime-api.js +0 -25
- package/dist/extensions/matrix/setup-entry.js +0 -6
- package/dist/extensions/matrix/test-api.js +0 -3
- package/dist/extensions/matrix/thread-bindings-runtime.js +0 -2
- package/dist/extensions/mattermost/api.js +0 -2
- package/dist/extensions/mattermost/index.js +0 -15
- package/dist/extensions/mattermost/openclaw.plugin.json +0 -11
- package/dist/extensions/mattermost/package.json +0 -41
- package/dist/extensions/mattermost/runtime-api.js +0 -41
- package/dist/extensions/mattermost/setup-entry.js +0 -6
- package/dist/extensions/memory-core/api.js +0 -1
- package/dist/extensions/memory-core/index.js +0 -440
- package/dist/extensions/memory-core/openclaw.plugin.json +0 -9
- package/dist/extensions/memory-core/package.json +0 -23
- package/dist/extensions/memory-core/runtime-api.js +0 -3
- package/dist/extensions/memory-lancedb/api.js +0 -4
- package/dist/extensions/memory-lancedb/config.js +0 -2
- package/dist/extensions/memory-lancedb/index.js +0 -7037
- package/dist/extensions/memory-lancedb/lancedb-runtime.js +0 -2
- package/dist/extensions/memory-lancedb/openclaw.plugin.json +0 -92
- package/dist/extensions/memory-lancedb/package.json +0 -24
- package/dist/extensions/microsoft/index.js +0 -13
- package/dist/extensions/microsoft/openclaw.plugin.json +0 -13
- package/dist/extensions/microsoft/package.json +0 -15
- package/dist/extensions/microsoft/speech-provider.js +0 -2
- package/dist/extensions/microsoft/test-api.js +0 -2
- package/dist/extensions/microsoft/tts.js +0 -2
- package/dist/extensions/microsoft-foundry/auth.js +0 -2
- package/dist/extensions/microsoft-foundry/cli.js +0 -2
- package/dist/extensions/microsoft-foundry/index.js +0 -13
- package/dist/extensions/microsoft-foundry/onboard.js +0 -3
- package/dist/extensions/microsoft-foundry/openclaw.plugin.json +0 -39
- package/dist/extensions/microsoft-foundry/package.json +0 -12
- package/dist/extensions/microsoft-foundry/provider.js +0 -2
- package/dist/extensions/microsoft-foundry/runtime.js +0 -2
- package/dist/extensions/microsoft-foundry/shared-runtime.js +0 -3
- package/dist/extensions/microsoft-foundry/shared.js +0 -2
- package/dist/extensions/minimax/api.js +0 -6
- package/dist/extensions/minimax/image-generation-provider.js +0 -2
- package/dist/extensions/minimax/index.js +0 -219
- package/dist/extensions/minimax/media-understanding-provider.js +0 -2
- package/dist/extensions/minimax/model-definitions.js +0 -2
- package/dist/extensions/minimax/oauth.js +0 -2
- package/dist/extensions/minimax/oauth.runtime.js +0 -2
- package/dist/extensions/minimax/onboard.js +0 -2
- package/dist/extensions/minimax/openclaw.plugin.json +0 -98
- package/dist/extensions/minimax/package.json +0 -12
- package/dist/extensions/minimax/provider-catalog.js +0 -2
- package/dist/extensions/minimax/provider-models.js +0 -2
- package/dist/extensions/mistral/api.js +0 -5
- package/dist/extensions/mistral/index.js +0 -79
- package/dist/extensions/mistral/media-understanding-provider.js +0 -2
- package/dist/extensions/mistral/model-definitions.js +0 -2
- package/dist/extensions/mistral/onboard.js +0 -2
- package/dist/extensions/mistral/openclaw.plugin.json +0 -37
- package/dist/extensions/mistral/package.json +0 -12
- package/dist/extensions/mistral/provider-catalog.js +0 -2
- package/dist/extensions/modelstudio/api.js +0 -4
- package/dist/extensions/modelstudio/index.js +0 -111
- package/dist/extensions/modelstudio/model-definitions.js +0 -2
- package/dist/extensions/modelstudio/models.js +0 -2
- package/dist/extensions/modelstudio/onboard.js +0 -3
- package/dist/extensions/modelstudio/openclaw.plugin.json +0 -75
- package/dist/extensions/modelstudio/package.json +0 -12
- package/dist/extensions/modelstudio/provider-catalog.js +0 -2
- package/dist/extensions/moonshot/api.js +0 -4
- package/dist/extensions/moonshot/index.js +0 -58
- package/dist/extensions/moonshot/media-understanding-provider.js +0 -2
- package/dist/extensions/moonshot/onboard.js +0 -2
- package/dist/extensions/moonshot/openclaw.plugin.json +0 -87
- package/dist/extensions/moonshot/package.json +0 -12
- package/dist/extensions/moonshot/provider-catalog.js +0 -2
- package/dist/extensions/moonshot/test-api.js +0 -2
- package/dist/extensions/moonshot/web-search-provider.js +0 -2
- package/dist/extensions/msteams/api.js +0 -2
- package/dist/extensions/msteams/channel-config-api.js +0 -2
- package/dist/extensions/msteams/index.js +0 -13
- package/dist/extensions/msteams/openclaw.plugin.json +0 -11
- package/dist/extensions/msteams/package.json +0 -48
- package/dist/extensions/msteams/runtime-api.js +0 -47
- package/dist/extensions/msteams/setup-entry.js +0 -6
- package/dist/extensions/msteams/test-api.js +0 -2
- package/dist/extensions/nextcloud-talk/api.js +0 -2
- package/dist/extensions/nextcloud-talk/index.js +0 -12
- package/dist/extensions/nextcloud-talk/openclaw.plugin.json +0 -11
- package/dist/extensions/nextcloud-talk/package.json +0 -45
- package/dist/extensions/nextcloud-talk/runtime-api.js +0 -35
- package/dist/extensions/nextcloud-talk/setup-entry.js +0 -6
- package/dist/extensions/nostr/api.js +0 -15
- package/dist/extensions/nostr/index.js +0 -559
- package/dist/extensions/nostr/openclaw.plugin.json +0 -11
- package/dist/extensions/nostr/package.json +0 -44
- package/dist/extensions/nostr/runtime-api.js +0 -15
- package/dist/extensions/nostr/setup-api.js +0 -2
- package/dist/extensions/nostr/setup-entry.js +0 -6
- package/dist/extensions/nostr/test-api.js +0 -2
- package/dist/extensions/nvidia/api.js +0 -2
- package/dist/extensions/nvidia/index.js +0 -16
- package/dist/extensions/nvidia/openclaw.plugin.json +0 -17
- package/dist/extensions/nvidia/package.json +0 -12
- package/dist/extensions/nvidia/provider-catalog.js +0 -2
- package/dist/extensions/ollama/api.js +0 -3
- package/dist/extensions/ollama/index.js +0 -139
- package/dist/extensions/ollama/openclaw.plugin.json +0 -29
- package/dist/extensions/ollama/package.json +0 -12
- package/dist/extensions/ollama/runtime-api.js +0 -3
- package/dist/extensions/open-prose/index.js +0 -10
- package/dist/extensions/open-prose/openclaw.plugin.json +0 -13
- package/dist/extensions/open-prose/package.json +0 -12
- package/dist/extensions/open-prose/runtime-api.js +0 -3
- package/dist/extensions/open-prose/skills/prose/LICENSE +0 -21
- package/dist/extensions/open-prose/skills/prose/SKILL.md +0 -323
- package/dist/extensions/open-prose/skills/prose/alt-borges.md +0 -141
- package/dist/extensions/open-prose/skills/prose/alts/arabian-nights.md +0 -229
- package/dist/extensions/open-prose/skills/prose/alts/borges.md +0 -360
- package/dist/extensions/open-prose/skills/prose/alts/folk.md +0 -322
- package/dist/extensions/open-prose/skills/prose/alts/homer.md +0 -217
- package/dist/extensions/open-prose/skills/prose/alts/kafka.md +0 -373
- package/dist/extensions/open-prose/skills/prose/alts/shared-appendix.md +0 -35
- package/dist/extensions/open-prose/skills/prose/compiler.md +0 -2971
- package/dist/extensions/open-prose/skills/prose/examples/01-hello-world.prose +0 -4
- package/dist/extensions/open-prose/skills/prose/examples/02-research-and-summarize.prose +0 -6
- package/dist/extensions/open-prose/skills/prose/examples/03-code-review.prose +0 -17
- package/dist/extensions/open-prose/skills/prose/examples/04-write-and-refine.prose +0 -14
- package/dist/extensions/open-prose/skills/prose/examples/05-debug-issue.prose +0 -20
- package/dist/extensions/open-prose/skills/prose/examples/06-explain-codebase.prose +0 -17
- package/dist/extensions/open-prose/skills/prose/examples/07-refactor.prose +0 -20
- package/dist/extensions/open-prose/skills/prose/examples/08-blog-post.prose +0 -20
- package/dist/extensions/open-prose/skills/prose/examples/09-research-with-agents.prose +0 -25
- package/dist/extensions/open-prose/skills/prose/examples/10-code-review-agents.prose +0 -32
- package/dist/extensions/open-prose/skills/prose/examples/11-skills-and-imports.prose +0 -27
- package/dist/extensions/open-prose/skills/prose/examples/12-secure-agent-permissions.prose +0 -43
- package/dist/extensions/open-prose/skills/prose/examples/13-variables-and-context.prose +0 -51
- package/dist/extensions/open-prose/skills/prose/examples/14-composition-blocks.prose +0 -48
- package/dist/extensions/open-prose/skills/prose/examples/15-inline-sequences.prose +0 -23
- package/dist/extensions/open-prose/skills/prose/examples/16-parallel-reviews.prose +0 -19
- package/dist/extensions/open-prose/skills/prose/examples/17-parallel-research.prose +0 -19
- package/dist/extensions/open-prose/skills/prose/examples/18-mixed-parallel-sequential.prose +0 -36
- package/dist/extensions/open-prose/skills/prose/examples/19-advanced-parallel.prose +0 -71
- package/dist/extensions/open-prose/skills/prose/examples/20-fixed-loops.prose +0 -20
- package/dist/extensions/open-prose/skills/prose/examples/21-pipeline-operations.prose +0 -35
- package/dist/extensions/open-prose/skills/prose/examples/22-error-handling.prose +0 -51
- package/dist/extensions/open-prose/skills/prose/examples/23-retry-with-backoff.prose +0 -63
- package/dist/extensions/open-prose/skills/prose/examples/24-choice-blocks.prose +0 -86
- package/dist/extensions/open-prose/skills/prose/examples/25-conditionals.prose +0 -114
- package/dist/extensions/open-prose/skills/prose/examples/26-parameterized-blocks.prose +0 -100
- package/dist/extensions/open-prose/skills/prose/examples/27-string-interpolation.prose +0 -105
- package/dist/extensions/open-prose/skills/prose/examples/28-automated-pr-review.prose +0 -37
- package/dist/extensions/open-prose/skills/prose/examples/28-gas-town.prose +0 -1572
- package/dist/extensions/open-prose/skills/prose/examples/29-captains-chair.prose +0 -218
- package/dist/extensions/open-prose/skills/prose/examples/30-captains-chair-simple.prose +0 -42
- package/dist/extensions/open-prose/skills/prose/examples/31-captains-chair-with-memory.prose +0 -145
- package/dist/extensions/open-prose/skills/prose/examples/33-pr-review-autofix.prose +0 -168
- package/dist/extensions/open-prose/skills/prose/examples/34-content-pipeline.prose +0 -204
- package/dist/extensions/open-prose/skills/prose/examples/35-feature-factory.prose +0 -296
- package/dist/extensions/open-prose/skills/prose/examples/36-bug-hunter.prose +0 -237
- package/dist/extensions/open-prose/skills/prose/examples/37-the-forge.prose +0 -1474
- package/dist/extensions/open-prose/skills/prose/examples/38-skill-scan.prose +0 -455
- package/dist/extensions/open-prose/skills/prose/examples/39-architect-by-simulation.prose +0 -277
- package/dist/extensions/open-prose/skills/prose/examples/40-rlm-self-refine.prose +0 -32
- package/dist/extensions/open-prose/skills/prose/examples/41-rlm-divide-conquer.prose +0 -38
- package/dist/extensions/open-prose/skills/prose/examples/42-rlm-filter-recurse.prose +0 -46
- package/dist/extensions/open-prose/skills/prose/examples/43-rlm-pairwise.prose +0 -50
- package/dist/extensions/open-prose/skills/prose/examples/44-run-endpoint-ux-test.prose +0 -261
- package/dist/extensions/open-prose/skills/prose/examples/45-plugin-release.prose +0 -159
- package/dist/extensions/open-prose/skills/prose/examples/45-run-endpoint-ux-test-with-remediation.prose +0 -637
- package/dist/extensions/open-prose/skills/prose/examples/46-run-endpoint-ux-test-fast.prose +0 -148
- package/dist/extensions/open-prose/skills/prose/examples/46-workflow-crystallizer.prose +0 -225
- package/dist/extensions/open-prose/skills/prose/examples/47-language-self-improvement.prose +0 -356
- package/dist/extensions/open-prose/skills/prose/examples/48-habit-miner.prose +0 -445
- package/dist/extensions/open-prose/skills/prose/examples/49-prose-run-retrospective.prose +0 -210
- package/dist/extensions/open-prose/skills/prose/examples/README.md +0 -391
- package/dist/extensions/open-prose/skills/prose/examples/roadmap/README.md +0 -22
- package/dist/extensions/open-prose/skills/prose/examples/roadmap/iterative-refinement.prose +0 -20
- package/dist/extensions/open-prose/skills/prose/examples/roadmap/parallel-review.prose +0 -18
- package/dist/extensions/open-prose/skills/prose/examples/roadmap/simple-pipeline.prose +0 -17
- package/dist/extensions/open-prose/skills/prose/examples/roadmap/syntax/open-prose-syntax.prose +0 -223
- package/dist/extensions/open-prose/skills/prose/guidance/antipatterns.md +0 -951
- package/dist/extensions/open-prose/skills/prose/guidance/patterns.md +0 -700
- package/dist/extensions/open-prose/skills/prose/guidance/system-prompt.md +0 -180
- package/dist/extensions/open-prose/skills/prose/help.md +0 -144
- package/dist/extensions/open-prose/skills/prose/lib/README.md +0 -108
- package/dist/extensions/open-prose/skills/prose/lib/calibrator.prose +0 -215
- package/dist/extensions/open-prose/skills/prose/lib/cost-analyzer.prose +0 -174
- package/dist/extensions/open-prose/skills/prose/lib/error-forensics.prose +0 -250
- package/dist/extensions/open-prose/skills/prose/lib/inspector.prose +0 -196
- package/dist/extensions/open-prose/skills/prose/lib/profiler.prose +0 -460
- package/dist/extensions/open-prose/skills/prose/lib/program-improver.prose +0 -275
- package/dist/extensions/open-prose/skills/prose/lib/project-memory.prose +0 -118
- package/dist/extensions/open-prose/skills/prose/lib/user-memory.prose +0 -93
- package/dist/extensions/open-prose/skills/prose/lib/vm-improver.prose +0 -243
- package/dist/extensions/open-prose/skills/prose/primitives/session.md +0 -593
- package/dist/extensions/open-prose/skills/prose/prose.md +0 -1237
- package/dist/extensions/open-prose/skills/prose/state/filesystem.md +0 -498
- package/dist/extensions/open-prose/skills/prose/state/in-context.md +0 -384
- package/dist/extensions/open-prose/skills/prose/state/postgres.md +0 -880
- package/dist/extensions/open-prose/skills/prose/state/sqlite.md +0 -531
- package/dist/extensions/openai/api.js +0 -4
- package/dist/extensions/openai/cli-backend.js +0 -2
- package/dist/extensions/openai/default-models.js +0 -2
- package/dist/extensions/openai/image-generation-provider.js +0 -2
- package/dist/extensions/openai/index.js +0 -24
- package/dist/extensions/openai/media-understanding-provider.js +0 -2
- package/dist/extensions/openai/openai-codex-auth-identity.js +0 -2
- package/dist/extensions/openai/openai-codex-catalog.js +0 -2
- package/dist/extensions/openai/openai-codex-provider.js +0 -2
- package/dist/extensions/openai/openai-codex-provider.runtime.js +0 -14
- package/dist/extensions/openai/openai-provider.js +0 -2
- package/dist/extensions/openai/openclaw.plugin.json +0 -61
- package/dist/extensions/openai/package.json +0 -12
- package/dist/extensions/openai/shared.js +0 -4
- package/dist/extensions/openai/speech-provider.js +0 -2
- package/dist/extensions/openai/test-api.js +0 -5
- package/dist/extensions/openai/tts.js +0 -2
- package/dist/extensions/opencode/api.js +0 -3
- package/dist/extensions/opencode/index.js +0 -63
- package/dist/extensions/opencode/onboard.js +0 -2
- package/dist/extensions/opencode/openclaw.plugin.json +0 -33
- package/dist/extensions/opencode/package.json +0 -12
- package/dist/extensions/opencode-go/api.js +0 -3
- package/dist/extensions/opencode-go/index.js +0 -54
- package/dist/extensions/opencode-go/onboard.js +0 -2
- package/dist/extensions/opencode-go/openclaw.plugin.json +0 -33
- package/dist/extensions/opencode-go/package.json +0 -12
- package/dist/extensions/openrouter/api.js +0 -3
- package/dist/extensions/openrouter/index.js +0 -121
- package/dist/extensions/openrouter/media-understanding-provider.js +0 -2
- package/dist/extensions/openrouter/onboard.js +0 -2
- package/dist/extensions/openrouter/openclaw.plugin.json +0 -37
- package/dist/extensions/openrouter/package.json +0 -12
- package/dist/extensions/openrouter/provider-catalog.js +0 -2
- package/dist/extensions/openshell/index.js +0 -919
- package/dist/extensions/openshell/openclaw.plugin.json +0 -118
- package/dist/extensions/openshell/package.json +0 -12
- package/dist/extensions/perplexity/index.js +0 -13
- package/dist/extensions/perplexity/openclaw.plugin.json +0 -54
- package/dist/extensions/perplexity/package.json +0 -12
- package/dist/extensions/perplexity/test-api.js +0 -2
- package/dist/extensions/perplexity/web-search-provider.js +0 -2
- package/dist/extensions/phone-control/index.js +0 -283
- package/dist/extensions/phone-control/openclaw.plugin.json +0 -11
- package/dist/extensions/phone-control/runtime-api.js +0 -3
- package/dist/extensions/qianfan/api.js +0 -3
- package/dist/extensions/qianfan/index.js +0 -26
- package/dist/extensions/qianfan/onboard.js +0 -2
- package/dist/extensions/qianfan/openclaw.plugin.json +0 -32
- package/dist/extensions/qianfan/package.json +0 -12
- package/dist/extensions/qianfan/provider-catalog.js +0 -2
- package/dist/extensions/qqbot/api.js +0 -173
- package/dist/extensions/qqbot/index.js +0 -445
- package/dist/extensions/qqbot/openclaw.plugin.json +0 -257
- package/dist/extensions/qqbot/package.json +0 -52
- package/dist/extensions/qqbot/runtime-api.js +0 -2
- package/dist/extensions/qqbot/setup-entry.js +0 -6
- package/dist/extensions/qqbot/skills/qqbot-channel/SKILL.md +0 -262
- package/dist/extensions/qqbot/skills/qqbot-channel/references/api_references.md +0 -521
- package/dist/extensions/qqbot/skills/qqbot-media/SKILL.md +0 -36
- package/dist/extensions/qqbot/skills/qqbot-remind/SKILL.md +0 -149
- package/dist/extensions/searxng/index.js +0 -13
- package/dist/extensions/searxng/openclaw.plugin.json +0 -46
- package/dist/extensions/searxng/package.json +0 -12
- package/dist/extensions/searxng/web-search-provider.js +0 -2
- package/dist/extensions/sglang/api.js +0 -4
- package/dist/extensions/sglang/defaults.js +0 -2
- package/dist/extensions/sglang/index.js +0 -77
- package/dist/extensions/sglang/models.js +0 -2
- package/dist/extensions/sglang/openclaw.plugin.json +0 -29
- package/dist/extensions/sglang/package.json +0 -12
- package/dist/extensions/signal/api.js +0 -7
- package/dist/extensions/signal/channel-config-api.js +0 -2
- package/dist/extensions/signal/index.js +0 -319
- package/dist/extensions/signal/openclaw.plugin.json +0 -11
- package/dist/extensions/signal/package.json +0 -24
- package/dist/extensions/signal/reaction-runtime-api.js +0 -2
- package/dist/extensions/signal/runtime-api.js +0 -24
- package/dist/extensions/signal/setup-entry.js +0 -13
- package/dist/extensions/signal/test-api.js +0 -111
- package/dist/extensions/slack/api.js +0 -10
- package/dist/extensions/slack/channel-config-api.js +0 -2
- package/dist/extensions/slack/index.js +0 -12
- package/dist/extensions/slack/openclaw.plugin.json +0 -11
- package/dist/extensions/slack/package.json +0 -31
- package/dist/extensions/slack/runtime-api.js +0 -110
- package/dist/extensions/slack/setup-entry.js +0 -12
- package/dist/extensions/slack/test-api.js +0 -47
- package/dist/extensions/stepfun/index.js +0 -163
- package/dist/extensions/stepfun/onboard.js +0 -3
- package/dist/extensions/stepfun/openclaw.plugin.json +0 -83
- package/dist/extensions/stepfun/package.json +0 -12
- package/dist/extensions/stepfun/provider-catalog.js +0 -2
- package/dist/extensions/synology-chat/index.js +0 -12
- package/dist/extensions/synology-chat/openclaw.plugin.json +0 -11
- package/dist/extensions/synology-chat/package.json +0 -26
- package/dist/extensions/synology-chat/setup-api.js +0 -2
- package/dist/extensions/synology-chat/setup-entry.js +0 -6
- package/dist/extensions/synthetic/api.js +0 -4
- package/dist/extensions/synthetic/index.js +0 -27
- package/dist/extensions/synthetic/models.js +0 -2
- package/dist/extensions/synthetic/onboard.js +0 -3
- package/dist/extensions/synthetic/openclaw.plugin.json +0 -32
- package/dist/extensions/synthetic/package.json +0 -12
- package/dist/extensions/synthetic/provider-catalog.js +0 -2
- package/dist/extensions/talk-voice/api.js +0 -3
- package/dist/extensions/talk-voice/index.js +0 -160
- package/dist/extensions/talk-voice/openclaw.plugin.json +0 -11
- package/dist/extensions/tavily/index.js +0 -128
- package/dist/extensions/tavily/openclaw.plugin.json +0 -53
- package/dist/extensions/tavily/package.json +0 -12
- package/dist/extensions/tavily/skills/tavily/SKILL.md +0 -94
- package/dist/extensions/tavily/web-search-provider.js +0 -2
- package/dist/extensions/telegram/allow-from.js +0 -2
- package/dist/extensions/telegram/api.js +0 -14
- package/dist/extensions/telegram/channel-config-api.js +0 -2
- package/dist/extensions/telegram/index.js +0 -12
- package/dist/extensions/telegram/openclaw.plugin.json +0 -11
- package/dist/extensions/telegram/package.json +0 -37
- package/dist/extensions/telegram/runtime-api.js +0 -25
- package/dist/extensions/telegram/session-key-api.js +0 -2
- package/dist/extensions/telegram/setup-entry.js +0 -13
- package/dist/extensions/telegram/test-api.js +0 -88
- package/dist/extensions/telegram/test-support.js +0 -46
- package/dist/extensions/telegram/update-offset-runtime-api.js +0 -2
- package/dist/extensions/thread-ownership/api.js +0 -5
- package/dist/extensions/thread-ownership/index.js +0 -82
- package/dist/extensions/thread-ownership/openclaw.plugin.json +0 -30
- package/dist/extensions/tlon/api.js +0 -14
- package/dist/extensions/tlon/index.js +0 -150
- package/dist/extensions/tlon/openclaw.plugin.json +0 -12
- package/dist/extensions/tlon/package.json +0 -44
- package/dist/extensions/tlon/runtime-api.js +0 -14
- package/dist/extensions/tlon/setup-api.js +0 -3
- package/dist/extensions/tlon/setup-entry.js +0 -6
- package/dist/extensions/tlon/test-api.js +0 -2
- package/dist/extensions/together/api.js +0 -3
- package/dist/extensions/together/index.js +0 -26
- package/dist/extensions/together/models.js +0 -2
- package/dist/extensions/together/onboard.js +0 -2
- package/dist/extensions/together/openclaw.plugin.json +0 -32
- package/dist/extensions/together/package.json +0 -12
- package/dist/extensions/together/provider-catalog.js +0 -2
- package/dist/extensions/twitch/api.js +0 -9
- package/dist/extensions/twitch/index.js +0 -1090
- package/dist/extensions/twitch/openclaw.plugin.json +0 -11
- package/dist/extensions/twitch/package.json +0 -29
- package/dist/extensions/twitch/runtime-api.js +0 -9
- package/dist/extensions/venice/api.js +0 -3
- package/dist/extensions/venice/index.js +0 -55
- package/dist/extensions/venice/models.js +0 -2
- package/dist/extensions/venice/onboard.js +0 -3
- package/dist/extensions/venice/openclaw.plugin.json +0 -32
- package/dist/extensions/venice/package.json +0 -12
- package/dist/extensions/venice/provider-catalog.js +0 -2
- package/dist/extensions/vercel-ai-gateway/api.js +0 -4
- package/dist/extensions/vercel-ai-gateway/index.js +0 -30
- package/dist/extensions/vercel-ai-gateway/models.js +0 -2
- package/dist/extensions/vercel-ai-gateway/onboard.js +0 -2
- package/dist/extensions/vercel-ai-gateway/openclaw.plugin.json +0 -32
- package/dist/extensions/vercel-ai-gateway/package.json +0 -12
- package/dist/extensions/vercel-ai-gateway/provider-catalog.js +0 -2
- package/dist/extensions/vllm/api.js +0 -4
- package/dist/extensions/vllm/defaults.js +0 -2
- package/dist/extensions/vllm/index.js +0 -78
- package/dist/extensions/vllm/models.js +0 -2
- package/dist/extensions/vllm/openclaw.plugin.json +0 -29
- package/dist/extensions/vllm/package.json +0 -12
- package/dist/extensions/voice-call/api.js +0 -7
- package/dist/extensions/voice-call/index.js +0 -698
- package/dist/extensions/voice-call/openclaw.plugin.json +0 -700
- package/dist/extensions/voice-call/package.json +0 -33
- package/dist/extensions/voice-call/runtime-api.js +0 -7
- package/dist/extensions/voice-call/runtime-entry.js +0 -2
- package/dist/extensions/volcengine/api.js +0 -3
- package/dist/extensions/volcengine/index.js +0 -63
- package/dist/extensions/volcengine/models.js +0 -2
- package/dist/extensions/volcengine/openclaw.plugin.json +0 -33
- package/dist/extensions/volcengine/package.json +0 -12
- package/dist/extensions/volcengine/provider-catalog.js +0 -2
- package/dist/extensions/whatsapp/action-runtime-api.js +0 -2
- package/dist/extensions/whatsapp/action-runtime.runtime.js +0 -2
- package/dist/extensions/whatsapp/api.js +0 -8
- package/dist/extensions/whatsapp/auth-presence.js +0 -2
- package/dist/extensions/whatsapp/channel-config-api.js +0 -2
- package/dist/extensions/whatsapp/constants.js +0 -2
- package/dist/extensions/whatsapp/index.js +0 -12
- package/dist/extensions/whatsapp/light-runtime-api.js +0 -5
- package/dist/extensions/whatsapp/login-qr-api.js +0 -2
- package/dist/extensions/whatsapp/openclaw.plugin.json +0 -11
- package/dist/extensions/whatsapp/package.json +0 -45
- package/dist/extensions/whatsapp/runtime-api.js +0 -334
- package/dist/extensions/whatsapp/setup-entry.js +0 -23
- package/dist/extensions/whatsapp/test-api.js +0 -76
- package/dist/extensions/xai/api.js +0 -6
- package/dist/extensions/xai/code-execution.js +0 -2
- package/dist/extensions/xai/index.js +0 -122
- package/dist/extensions/xai/model-definitions.js +0 -2
- package/dist/extensions/xai/model-id.js +0 -2
- package/dist/extensions/xai/onboard.js +0 -2
- package/dist/extensions/xai/openclaw.plugin.json +0 -157
- package/dist/extensions/xai/package.json +0 -12
- package/dist/extensions/xai/provider-catalog.js +0 -2
- package/dist/extensions/xai/provider-models.js +0 -2
- package/dist/extensions/xai/stream.js +0 -2
- package/dist/extensions/xai/web-search.js +0 -2
- package/dist/extensions/xai/x-search.js +0 -2
- package/dist/extensions/xiaomi/api.js +0 -3
- package/dist/extensions/xiaomi/index.js +0 -37
- package/dist/extensions/xiaomi/onboard.js +0 -2
- package/dist/extensions/xiaomi/openclaw.plugin.json +0 -32
- package/dist/extensions/xiaomi/package.json +0 -12
- package/dist/extensions/xiaomi/provider-catalog.js +0 -2
- package/dist/extensions/zai/api.js +0 -3
- package/dist/extensions/zai/detect.js +0 -2
- package/dist/extensions/zai/index.js +0 -239
- package/dist/extensions/zai/media-understanding-provider.js +0 -2
- package/dist/extensions/zai/model-definitions.js +0 -2
- package/dist/extensions/zai/onboard.js +0 -2
- package/dist/extensions/zai/openclaw.plugin.json +0 -94
- package/dist/extensions/zai/package.json +0 -12
- package/dist/extensions/zai/runtime-api.js +0 -3
- package/dist/extensions/zalo/api.js +0 -3
- package/dist/extensions/zalo/index.js +0 -13
- package/dist/extensions/zalo/openclaw.plugin.json +0 -11
- package/dist/extensions/zalo/package.json +0 -47
- package/dist/extensions/zalo/runtime-api.js +0 -38
- package/dist/extensions/zalo/setup-entry.js +0 -6
- package/dist/extensions/zalo/test-api.js +0 -2
- package/dist/extensions/zalouser/api.js +0 -2
- package/dist/extensions/zalouser/index.js +0 -599
- package/dist/extensions/zalouser/openclaw.plugin.json +0 -11
- package/dist/extensions/zalouser/package.json +0 -48
- package/dist/extensions/zalouser/runtime-api.js +0 -30
- package/dist/extensions/zalouser/setup-entry.js +0 -13
- package/dist/extensions/zalouser/test-api.js +0 -5
- package/dist/external-content-DtoRY-d1.js +0 -242
- package/dist/facade-runtime-Bpi4Gy-u.js +0 -263
- package/dist/failover-error-BrdBIFg2.js +0 -180
- package/dist/feishu-81Iv8tqF.js +0 -18
- package/dist/feishu-conversation-NmEqAxSA.js +0 -17
- package/dist/feishu-setup-DXAK6GqE.js +0 -12
- package/dist/fetch-7dbKQPT5.js +0 -256
- package/dist/fetch-BjiGl865.js +0 -418
- package/dist/fetch-Bp23aO5S.js +0 -65
- package/dist/fetch-guard-BnhVFBtf.js +0 -150
- package/dist/fetch-mock-WghRRNpK.js +0 -6
- package/dist/fetch-runtime-DfFmkkZH.js +0 -4
- package/dist/fetch-timeout-BKMGkHu9.js +0 -58
- package/dist/file-identity-DPm-6kp0.js +0 -567
- package/dist/file-lock-CH0V9dhL.js +0 -141
- package/dist/file-lock-D292sbfa.js +0 -2
- package/dist/firecrawl-client-GOGPuEeg.js +0 -338
- package/dist/firecrawl-search-provider-ptp7GNAt.js +0 -47
- package/dist/format-BwzSM9vY.js +0 -24
- package/dist/format-D38w0aKT.js +0 -817
- package/dist/format-DCFsK8oa.js +0 -19
- package/dist/format-datetime-Bl6-b7G1.js +0 -73
- package/dist/format-duration-DqcpDYkZ.js +0 -57
- package/dist/format-relative-CYrRyrT7.js +0 -54
- package/dist/frontmatter-Ba2Hn11b.js +0 -45
- package/dist/frontmatter-Cjxy4vX8.js +0 -210
- package/dist/fs-safe-BQ59ttjX.js +0 -999
- package/dist/gateway-CWPyH-P7.js +0 -2575
- package/dist/gateway-cli-BmPBPCcJ.js +0 -1572
- package/dist/gateway-discovery-targets--oNzWOVw.js +0 -430
- package/dist/gateway-install-token-tyQyR2ED.js +0 -230
- package/dist/gateway-lock-BbUQuUet.js +0 -292
- package/dist/gateway-presence-BVCIm1hy.js +0 -15
- package/dist/gateway-registry-tQcIThkV.js +0 -74
- package/dist/gateway-rpc-BXdoSPN7.js +0 -26
- package/dist/gateway-runtime-C7EhkU_c.js +0 -12
- package/dist/gaxios-fetch-compat-D4gl5582.js +0 -180
- package/dist/gemini-auth-Dlpcd9MB.js +0 -29
- package/dist/gemini-web-search-provider-CkNEl2du.js +0 -162
- package/dist/get-reply-from-config.runtime-vBmBttxw.js +0 -2
- package/dist/get-reply-from-config.runtime.js +0 -1
- package/dist/git-commit-BS28SZVT.js +0 -2
- package/dist/git-commit-ChiOoWyK.js +0 -177
- package/dist/github-copilot-login-B8s4OVQ4.js +0 -11
- package/dist/github-copilot-token-BwXtH-ZJ.js +0 -2
- package/dist/github-copilot-token-D81Wvm8b.js +0 -2
- package/dist/github-copilot-token-beHjQGOp.js +0 -91
- package/dist/global-singleton-54zT3rCn.js +0 -13
- package/dist/global-singleton-iOq2_-p8.js +0 -1
- package/dist/global-state-DUuMGgts.js +0 -17
- package/dist/globals-CDtV0ht8.js +0 -25
- package/dist/gmail-setup-utils-CxXfU7cy.js +0 -421
- package/dist/google-Cx1_z3Q3.js +0 -24
- package/dist/googlechat-CoiMNDC2.js +0 -37
- package/dist/graph-users-BmZWavVH.js +0 -917
- package/dist/group-access-BZZ3FNmb.js +0 -32
- package/dist/group-access-BjveEAjz.js +0 -113
- package/dist/group-access-owHLoCWX.js +0 -119
- package/dist/group-activation-ClEb7qwj.js +0 -22
- package/dist/group-id-CcsUNOct.js +0 -11
- package/dist/group-policy-Bb8dxOpM.js +0 -25
- package/dist/group-policy-G9GcSyph.js +0 -201
- package/dist/group-policy-wS9F8Y_i.js +0 -51
- package/dist/group-policy-warnings-CL2gHsXM.js +0 -196
- package/dist/groups.runtime-K758xQFV.js +0 -6
- package/dist/groups.runtime.js +0 -1
- package/dist/handle-action-CE4vpa7G.js +0 -500
- package/dist/health-D_KQbqQY.js +0 -577
- package/dist/health-a1VPtSyV.js +0 -2
- package/dist/health-format-COR93f8W.js +0 -26
- package/dist/heartbeat-C_TrErgd.js +0 -122
- package/dist/heartbeat-reply-payload-C7Ac3fOZ.js +0 -13
- package/dist/heartbeat-summary-v5gPj5bd.js +0 -57
- package/dist/heartbeat-visibility-CHMO4pmJ.js +0 -102
- package/dist/help-CyR1Oo4X.js +0 -81
- package/dist/help-format-l1phKNA8.js +0 -15
- package/dist/helpers-COHnQbWX.js +0 -32
- package/dist/helpers-DNpD7VMo.js +0 -24
- package/dist/history-B4mW8GfY.js +0 -102
- package/dist/home-dir-n9onX5PG.js +0 -83
- package/dist/hook-runner-global-C9GhdBtf.js +0 -632
- package/dist/hook-runner-global-Cr_Pthp4.js +0 -2
- package/dist/hook-runtime-DK8QF-2x.js +0 -3
- package/dist/hooks-cli-XCo-7nz9.js +0 -353
- package/dist/hooks-policy-BmULXBcp.js +0 -20
- package/dist/hooks-status-D_ZxRD0H.js +0 -86
- package/dist/host-env-security-SlXI58bc.js +0 -290
- package/dist/host-runtime-BGHb06HN.js +0 -1
- package/dist/hostname-BRYLr_mh.js +0 -8
- package/dist/http-body-CfdQSEp0.js +0 -238
- package/dist/http-client-_3i4-nw5.js +0 -294
- package/dist/http-registry-ZGSBfYSe.js +0 -54
- package/dist/http-route-overlap-C8lbolN5.js +0 -101
- package/dist/identity-BoQQh6Y8.js +0 -26
- package/dist/identity-D64Wfv_s.js +0 -29
- package/dist/identity-DvwF6Yix.js +0 -84
- package/dist/identity-avatar-DPBgVwpU.js +0 -86
- package/dist/identity-file-BtIJI4dn.js +0 -60
- package/dist/image-C4V19x9x.js +0 -152
- package/dist/image-generation-BbOnazXi.js +0 -1
- package/dist/image-generation-provider-CQK8HA0O.js +0 -136
- package/dist/image-generation-provider-CWUvRxmv.js +0 -131
- package/dist/image-generation-provider-F2sfNjcr.js +0 -281
- package/dist/image-ops-BJKjhMAu.js +0 -476
- package/dist/image-runtime-DodXcK2e.js +0 -7
- package/dist/imessage-2ukkzufG.js +0 -19
- package/dist/inbound-context-Cxvd3JHZ.js +0 -59
- package/dist/inbound-context-Czd3FdNb.js +0 -52
- package/dist/inbound-debounce-CI7l3R36.js +0 -159
- package/dist/inbound-envelope-LyHTUTue.js +0 -61
- package/dist/inbound-reply-dispatch-BdeY6N-k.js +0 -73
- package/dist/inbound-text-CacimZtw.js +0 -14
- package/dist/inbound.runtime-CqX3n132.js +0 -3
- package/dist/inbound.runtime.js +0 -1
- package/dist/includes-Ccr-Q5DB.js +0 -188
- package/dist/includes-scan-DVvYLj4S.js +0 -55
- package/dist/index.js +0 -56
- package/dist/infra/warning-filter.js +0 -2
- package/dist/infra-runtime-Cl0iZpRS.js +0 -22
- package/dist/input-files-PZC6ZR4W.js +0 -251
- package/dist/input-provenance-8GBFuk0Q.js +0 -44
- package/dist/inspect-B8dw6NVJ.js +0 -286
- package/dist/install-Bk7XyvtC.js +0 -590
- package/dist/install-package-dir-C2ba2toB.js +0 -284
- package/dist/install-safe-path-CkCd0rWS.js +0 -69
- package/dist/install-security-scan-C02VaEU9.js +0 -22
- package/dist/install-security-scan.runtime-CDUuS6Dl.js +0 -299
- package/dist/install-security-scan.runtime.js +0 -1
- package/dist/install-source-utils-2tdWQmwI.js +0 -167
- package/dist/install-target-CBNysuiP.js +0 -175
- package/dist/install.runtime-D_zKCpnB.js +0 -11
- package/dist/install.runtime-DjQozvMe.js +0 -27
- package/dist/install.runtime.js +0 -1
- package/dist/installs-BnAbQ70v.js +0 -28
- package/dist/interactive-CEnsu1RT.js +0 -8
- package/dist/interactive-runtime-Bxq5ztle.js +0 -1
- package/dist/internal-Lk0wFTNq.js +0 -411
- package/dist/internal-hooks-C3ziA7w_.js +0 -155
- package/dist/io-BUxKr33U.js +0 -2236
- package/dist/io-BuMkfjp3.js +0 -4
- package/dist/ip-BZP18dDl.js +0 -208
- package/dist/ipv4-Xiyu1rvD.js +0 -82
- package/dist/irc-DXfYh-Sd.js +0 -14
- package/dist/irc-surface-Di-joPuc.js +0 -15
- package/dist/is-main-Bv5ej4lF.js +0 -27
- package/dist/issue-format-8Eylt-2O.js +0 -2
- package/dist/issue-format-DLZczJ0U.js +0 -31
- package/dist/json-file-5xJqyXrK.js +0 -23
- package/dist/json-files-C4lsZ_HR.js +0 -72
- package/dist/json-mode-4O1xL2fT.js +0 -34
- package/dist/json-pointer-C30cknnZ.js +0 -43
- package/dist/json-store-FUgu1pyj.js +0 -37
- package/dist/keyed-async-queue-BTOTBE8n.js +0 -32
- package/dist/kill-tree-CIfAbzdN.js +0 -2
- package/dist/kill-tree-CUPpLbeq.js +0 -82
- package/dist/kimi-web-search-provider-Cb3F9_Da.js +0 -224
- package/dist/known-users-DjerpGCB.js +0 -167
- package/dist/lancedb-runtime-DTb_mDUG.js +0 -201
- package/dist/launchd-cp98MUhz.js +0 -517
- package/dist/lazy-runtime-C6LCAM-L.js +0 -29
- package/dist/lazy-runtime-yh_WT4on.js +0 -1
- package/dist/lazy-service-module-CeifO9oo.js +0 -24
- package/dist/legacy-crypto-restore-CsHmLVjY.js +0 -85
- package/dist/legacy-names-CFo8Oe-2.js +0 -9
- package/dist/legacy-web-search-Bn8F2jrN.js +0 -140
- package/dist/legacy.shared-oZM32end.js +0 -45
- package/dist/level-overrides-gqc8xfh2.js +0 -36
- package/dist/library-ChjjeniJ.js +0 -44
- package/dist/lifecycle-core-Ce_ZEvjl.js +0 -402
- package/dist/line-Be0jY3CU.js +0 -4
- package/dist/line-runtime-B0ZGTK81.js +0 -60
- package/dist/line-surface-BTopinac.js +0 -27
- package/dist/links-D7o22Ygt.js +0 -17
- package/dist/listeners-_47QWN8-.js +0 -14
- package/dist/llm-slug-generator-Dv-sLOW9.js +0 -68
- package/dist/llm-slug-generator.js +0 -2
- package/dist/llm-task-BDA3i86A.js +0 -3
- package/dist/load-BXSzQ8YA.js +0 -28
- package/dist/load-options-BqszWkkN.js +0 -36
- package/dist/loader-DsZDoLQ6.js +0 -2519
- package/dist/local-file-access-PajXzDdK.js +0 -49
- package/dist/local-roots-DrpNBv4b.js +0 -46
- package/dist/location-CtMHXE-d.js +0 -42
- package/dist/logger-Bc2lC3X3.js +0 -79
- package/dist/logger-CIV9WBoa.js +0 -11
- package/dist/logger-DdGvppaE.js +0 -75
- package/dist/logger-MWEZrHUL.js +0 -582
- package/dist/logging-B1QD0DRq.js +0 -2
- package/dist/logging-CAfgK7sj.js +0 -3
- package/dist/logging-ColPHIDT.js +0 -16
- package/dist/logging-D4xyCEzZ.js +0 -85
- package/dist/logging-Dt_aiHur.js +0 -13
- package/dist/logging-Dywye6yZ.js +0 -2
- package/dist/logging-core-hw7Df6Hl.js +0 -3
- package/dist/login-BrqdQcNh.js +0 -108
- package/dist/login-DSqrZNW-.js +0 -2333
- package/dist/login-qr-Dm3iC25_.js +0 -212
- package/dist/login-qr-api-BxRDJKkp.js +0 -16
- package/dist/logs-cli-CxjV80As.js +0 -221
- package/dist/magic-string.es-CVHNyqW1.js +0 -1011
- package/dist/main-session-BbO0A-No.js +0 -38
- package/dist/manager-c_fEco8X.js +0 -2773
- package/dist/manager-runtime-Vy_F8ORR.js +0 -2
- package/dist/manager.runtime-Bm1Knq-3.js +0 -670
- package/dist/manager.runtime.js +0 -1
- package/dist/manifest-f_gihArl.js +0 -237
- package/dist/manifest-registry-Kx5Z2lJL.js +0 -1069
- package/dist/map-size-BBQq2RPq.js +0 -15
- package/dist/markdown-table-runtime-Dx12DQTq.js +0 -2
- package/dist/markdown-tables-CSlyhQVP.js +0 -31
- package/dist/mask-api-key-BYVFDQdo.js +0 -10
- package/dist/matrix-NDa-FoaE.js +0 -351
- package/dist/matrix-config-helpers-D0D-oL7I.js +0 -153
- package/dist/matrix-helper-DioFIiaO.js +0 -20
- package/dist/matrix-migration-snapshot-DAOFFSgM.js +0 -714
- package/dist/matrix-ouiFsVI1.js +0 -39
- package/dist/matrix-runtime-heavy-KUEg_MfD.js +0 -4
- package/dist/matrix-runtime-shared-B6aE5Uu6.js +0 -1
- package/dist/matrix-runtime-surface-R78Hde6Q.js +0 -12
- package/dist/matrix-surface-B-nU-e0B.js +0 -13
- package/dist/matrix-thread-bindings-B77Krs8r.js +0 -12
- package/dist/mattermost-Cg2PI71s.js +0 -18
- package/dist/mcp/plugin-tools-serve.js +0 -105
- package/dist/mcp-cli-BMNT4RIm.js +0 -768
- package/dist/mcp-config-3y1z3N2x.js +0 -118
- package/dist/media-CUdiVhEt.js +0 -1691
- package/dist/media-limits-DmcT5KnO.js +0 -14
- package/dist/media-runtime-8QR_uTs0.js +0 -295
- package/dist/media-understanding-CpMkSmKj.js +0 -51
- package/dist/media-understanding-provider-C0xVBaas.js +0 -11
- package/dist/media-understanding-provider-C8RSrdEy.js +0 -16
- package/dist/media-understanding-provider-CCB6_bwc2.js +0 -9
- package/dist/media-understanding-provider-CZ83ep6L.js +0 -16
- package/dist/media-understanding-provider-Cmcg82YY.js +0 -28
- package/dist/media-understanding-provider-D1_z5Kwx.js +0 -11
- package/dist/media-understanding-provider-DC9bhcFj.js +0 -11
- package/dist/media-understanding-provider-DbMV-bHu.js +0 -17
- package/dist/media-understanding-provider-Drg3Vyoe.js +0 -86
- package/dist/media-understanding-runtime-JIhXSD7e.js +0 -15
- package/dist/media-understanding.runtime-2Muvvak4.js +0 -7
- package/dist/media-understanding.runtime.js +0 -1
- package/dist/memory-DPYsR3Cn.js +0 -228
- package/dist/memory-core-engine-runtime-DP_nzKMm.js +0 -14
- package/dist/memory-core-host-engine-embeddings-BhsmnP-6.js +0 -1370
- package/dist/memory-core-host-engine-foundation-CtFD8jpc.js +0 -10
- package/dist/memory-core-host-engine-qmd-DCvmid82.js +0 -375
- package/dist/memory-core-host-engine-storage-N3YflxjF.js +0 -109
- package/dist/memory-core-host-multimodal-BVd6eEE3.js +0 -1
- package/dist/memory-core-host-query-Bxzu0mAD.js +0 -2
- package/dist/memory-core-host-runtime-cli-nz5fxbbn.js +0 -10
- package/dist/memory-core-host-runtime-core-BcGQFQUw.js +0 -8
- package/dist/memory-core-host-runtime-files-DO5A0pY5.js +0 -3
- package/dist/memory-core-host-secret-CQAiTACg.js +0 -1
- package/dist/memory-core-host-status-0g2XexDn.js +0 -44
- package/dist/memory-embedding-providers-BOMS0u3X.js +0 -34
- package/dist/memory-lancedb-kZBcB07O.js +0 -2
- package/dist/memory-runtime-BIGGpmaC.js +0 -2
- package/dist/memory-runtime-XyiDon5w.js +0 -34
- package/dist/memory-search-CQFSugEg.js +0 -2
- package/dist/memory-search-DpAYXyjc.js +0 -202
- package/dist/memory-state-DDJh6L4-.js +0 -41
- package/dist/mention-gating-_kzByrvM.js +0 -25
- package/dist/mentions-BCBF5Klg.js +0 -65
- package/dist/mentions-BKYgZd-C.js +0 -155
- package/dist/merge-patch-CtvE2OP0.js +0 -65
- package/dist/message-Dna6Vsdg.js +0 -205
- package/dist/message-action-discovery-CPTCAl8K.js +0 -133
- package/dist/message-action-runner-Byldnjex.js +0 -1703
- package/dist/message-channel-bEWdw4ul.js +0 -105
- package/dist/message-handler-C9TRy9hy.js +0 -1771
- package/dist/message-hook-mappers-CzwFvq_c.js +0 -255
- package/dist/messages-CQT2FDZ3.js +0 -270
- package/dist/method-scopes-B6e_KuRU.js +0 -2663
- package/dist/migrate-cli-C_iDle77.js +0 -500
- package/dist/migration-snapshot.runtime-DAzTUgU-.js +0 -3
- package/dist/migration-snapshot.runtime.js +0 -1
- package/dist/mime-DkaKoCVP.js +0 -156
- package/dist/min-host-version-CIhgRq0c.js +0 -349
- package/dist/minimax-vlm-Dh6g-MLh.js +0 -512
- package/dist/model-auth-DcCyGs_6.js +0 -377
- package/dist/model-auth-env-OT6ucjoP.js +0 -63
- package/dist/model-auth-label-fGtOs2u-.js +0 -45
- package/dist/model-auth-markers-D2z_AIuC.js +0 -70
- package/dist/model-auth-runtime-shared-DnhseQ_3.js +0 -18
- package/dist/model-buttons-zQ-cRhqo.js +0 -187
- package/dist/model-catalog-f9zO4b6C.js +0 -208
- package/dist/model-catalog.runtime-iRu_OMJS.js +0 -2
- package/dist/model-catalog.runtime.js +0 -1
- package/dist/model-definitions-BGWurJeM.js +0 -49
- package/dist/model-definitions-C-e07VgA.js +0 -255
- package/dist/model-definitions-DUANiLUG.js +0 -126
- package/dist/model-definitions-DrxdjAkB.js +0 -202
- package/dist/model-id-9W_sHLHy.js +0 -12
- package/dist/model-id-DEv7HEyl.js +0 -20
- package/dist/model-input-DwbpFRYm.js +0 -20
- package/dist/model-overrides-BaecXmMv.js +0 -84
- package/dist/model-overrides-UUODi1G1.js +0 -91
- package/dist/model-param-b-BHlbSl5R.js +0 -15
- package/dist/model-picker-BgVMnja3.js +0 -439
- package/dist/model-picker-D8elZqN_.js +0 -3
- package/dist/model-picker.runtime-BUfgRpvT.js +0 -15
- package/dist/model-picker.runtime.js +0 -1
- package/dist/model-runtime-CkjgxQmB.js +0 -1772
- package/dist/model-selection-DXY5nwui.js +0 -407
- package/dist/model-selection-Dx6Ag-ZE.js +0 -505
- package/dist/model-suppression-C8XSEnsv.js +0 -24
- package/dist/model-suppression.runtime-Dqra9AAF.js +0 -7
- package/dist/model-suppression.runtime.js +0 -1
- package/dist/models--Ze_o5z6.js +0 -193
- package/dist/models-7_w_ynp7.js +0 -35
- package/dist/models-BMmB_oQc.js +0 -130
- package/dist/models-B_TKM4gG.js +0 -18
- package/dist/models-B_UROL5b.js +0 -3
- package/dist/models-BmDGSZCK.js +0 -31
- package/dist/models-BywIyTzh.js +0 -126
- package/dist/models-C5GB-E7D.js +0 -154
- package/dist/models-DU3Lv10g.js +0 -754
- package/dist/models-VgpjMiqM.js +0 -138
- package/dist/models-_DZVZ2Na.js +0 -18
- package/dist/models-bBe0FFJe.js +0 -2550
- package/dist/models-cli-kZR11PgM.js +0 -197
- package/dist/models-config-D6j7jkCN.js +0 -2
- package/dist/models-config-lYKxSxLo.js +0 -1106
- package/dist/models-config.runtime-D2tdVUsi.js +0 -2
- package/dist/models-config.runtime.js +0 -1
- package/dist/models-emJUoDsF.js +0 -40
- package/dist/models-gPCm0Fco.js +0 -122
- package/dist/models-mi7nu17U.js +0 -99
- package/dist/models-nUP9ZPV8.js +0 -552
- package/dist/models-provider-runtime-DfIZ0cvV.js +0 -2
- package/dist/monitor-BEjwRY59.js +0 -3622
- package/dist/monitor-BiwufaF7.js +0 -718
- package/dist/monitor-BqwlHm94.js +0 -3660
- package/dist/monitor-Cj6Atk8I.js +0 -676
- package/dist/monitor-D2qBnOYz.js +0 -666
- package/dist/monitor-DZmBV1Nj2.js +0 -2
- package/dist/monitor-RMoB6sGQ.js +0 -4067
- package/dist/monitor-auth-EvlH1zbN.js +0 -192
- package/dist/monitor-lbUydC5_.js +0 -1525
- package/dist/monitor-polling.runtime-O6ZG6yYv.js +0 -307
- package/dist/monitor-polling.runtime.js +0 -1
- package/dist/monitor-provider-x4TUmYNN.js +0 -1782
- package/dist/monitor-vE0skDM1.js +0 -687
- package/dist/monitor-webhook.runtime-DoTv_oZv.js +0 -297
- package/dist/monitor-webhook.runtime.js +0 -1
- package/dist/moonshot-stream-wrappers-Csssd6kW.js +0 -24
- package/dist/moonshot-thinking-stream-wrappers-D3j6Q9Yk.js +0 -69
- package/dist/msteams-DsFLaFEV.js +0 -33
- package/dist/multimodal-DoXQtvBl.js +0 -66
- package/dist/mutable-allowlist-detectors-CbFK2eTK.js +0 -62
- package/dist/native-command-registry-B4BAqmAW.js +0 -2
- package/dist/native-command-session-targets-DfUCBY63.js +0 -10
- package/dist/net-DjzoSxQo.js +0 -265
- package/dist/network-discovery-display-h8MqTMCI.js +0 -48
- package/dist/network-mode-QjJNOXMa.js +0 -17
- package/dist/nextcloud-talk-COZ5YrPY.js +0 -18
- package/dist/node-cli-z8LHYl1w.js +0 -2323
- package/dist/node-command-policy-DoeXKD1V.js +0 -205
- package/dist/node-commands-ycnRypMq.js +0 -11
- package/dist/node-require-BgDD9bTi.js +0 -14
- package/dist/node-resolve-Drr1RIcN.js +0 -110
- package/dist/node-service-Nyf8eLc4.js +0 -68
- package/dist/node-startup-env-CVMjxAUF.js +0 -50
- package/dist/nodes-cli-BMyafV_R.js +0 -1044
- package/dist/nodes-screen-oyGHNlY5.js +0 -219
- package/dist/nodes.helpers-DKBA9twS.js +0 -203
- package/dist/normalize-C46CugdT.js +0 -35
- package/dist/normalize-reply-VrMa_PA2.js +0 -500
- package/dist/normalize-secret-input-CC9iFcnK.js +0 -32
- package/dist/nostr-DGfd-Skj.js +0 -19
- package/dist/note-B5R9zt2K.js +0 -109
- package/dist/notify-CKEt6MKY.js +0 -298
- package/dist/npm-registry-spec-dWUFCqDk.js +0 -100
- package/dist/oauth-BBIy_OBl.js +0 -152
- package/dist/oauth-DzMUt9ZO.js +0 -56
- package/dist/oauth.credentials-CKrXIXPf.js +0 -119
- package/dist/oauth.flow-Dd6MZcHS.js +0 -122
- package/dist/oauth.http-CZlbXoZD.js +0 -23
- package/dist/oauth.project-DAVNbct7.js +0 -125
- package/dist/oauth.shared-D1_wwlyt.js +0 -26
- package/dist/oauth.token-CnB-w_v2.js +0 -42
- package/dist/ollama-EE_SvO8P.js +0 -26
- package/dist/onboard-2otvb4-n.js +0 -307
- package/dist/onboard-72nGEzpd.js +0 -25
- package/dist/onboard-B14oDS4M.js +0 -23
- package/dist/onboard-BH5hcOyK.js +0 -39
- package/dist/onboard-BRkQIFt_.js +0 -25
- package/dist/onboard-BSArlkkq.js +0 -73
- package/dist/onboard-Bau_HSmO.js +0 -36
- package/dist/onboard-BsqpQhXj.js +0 -591
- package/dist/onboard-CBa7u1iZ.js +0 -25
- package/dist/onboard-CLKZrJow.js +0 -29
- package/dist/onboard-COaMJ5wS.js +0 -28
- package/dist/onboard-CbTQZti9.js +0 -48
- package/dist/onboard-Ce3rcBNR.js +0 -29
- package/dist/onboard-CiMzgSvO.js +0 -67
- package/dist/onboard-DNuWjUOg.js +0 -17
- package/dist/onboard-DY3JtOcX.js +0 -47
- package/dist/onboard-Dd_eFJ7g.js +0 -25
- package/dist/onboard-DgMI-C3P.js +0 -24
- package/dist/onboard-Dj3Kkl9C.js +0 -49
- package/dist/onboard-Djne8OY8.js +0 -34
- package/dist/onboard-DnNU28xK.js +0 -48
- package/dist/onboard-MFS79j1I.js +0 -23
- package/dist/onboard-REHqRyQm.js +0 -26
- package/dist/onboard-VVnzyvuh.js +0 -46
- package/dist/onboard-channels-B8UocRdo.js +0 -705
- package/dist/onboard-channels-Ci5QQyQ0.js +0 -2
- package/dist/onboard-config-7edS4yYd.js +0 -2
- package/dist/onboard-config-C-6p2HNL.js +0 -29
- package/dist/onboard-custom-BREC7K0s.js +0 -2
- package/dist/onboard-custom-D7oXiV6u.js +0 -646
- package/dist/onboard-helpers-BCIfy96O.js +0 -4
- package/dist/onboard-helpers-CLedS83g.js +0 -227
- package/dist/onboard-hooks-DW0gav3i.js +0 -52
- package/dist/onboard-lh38uUOa.js +0 -25
- package/dist/onboard-rH_HA9v-.js +0 -34
- package/dist/onboard-remote-DG5Rb2y7.js +0 -2
- package/dist/onboard-remote-DgDwHLCW.js +0 -193
- package/dist/onboard-search-Bz78SAON.js +0 -339
- package/dist/onboard-skills-BK1iF6NI.js +0 -2
- package/dist/onboard-skills-Cfs4Gz-d.js +0 -134
- package/dist/openai-B3atWWiZ.js +0 -21
- package/dist/openai-codex-auth-identity-blYgqX5I.js +0 -40
- package/dist/openai-codex-catalog-DQoW5ntP.js +0 -11
- package/dist/openai-codex-provider-BeX3_fQL.js +0 -254
- package/dist/openai-provider-DfSRc815.js +0 -272
- package/dist/openai-stream-wrappers-Cmn9nSYj.js +0 -338
- package/dist/openclaw-exec-env-DnTrPIdx.js +0 -17
- package/dist/openclaw-root-F1SOdmJ0.js +0 -88
- package/dist/openclaw-tools.runtime-Dx73yE1V.js +0 -2
- package/dist/openclaw-tools.runtime.js +0 -1
- package/dist/operator-approvals-client-NQtGN5k_.js +0 -33
- package/dist/order-DNBhjW6F.js +0 -744
- package/dist/origin-routing-BC2EzQqM.js +0 -15
- package/dist/origin-routing-BVUTLJGu.js +0 -2
- package/dist/os-summary-CdlXkpL1.js +0 -26
- package/dist/outbound-adapter-D6WGzS7P.js +0 -183
- package/dist/outbound-ek4CqhT2.js +0 -2
- package/dist/outbound-hgMEZIU9.js +0 -2739
- package/dist/outbound-media-B2ZrkOxl.js +0 -15
- package/dist/outbound-runtime-CtDmQy3z.js +0 -2
- package/dist/outbound-send-deps-COPf3lwV.js +0 -7
- package/dist/outbound-session-DHKvttsz.js +0 -41
- package/dist/pairing-challenge-O7jo1Q5R.js +0 -33
- package/dist/pairing-cli-BEUxC5EH.js +0 -116
- package/dist/pairing-labels-Cj1fFxG9.js +0 -7
- package/dist/pairing-message-FaqHPEFk.js +0 -4
- package/dist/pairing-messages-DxLpe0GE.js +0 -23
- package/dist/pairing-pending-DGyUpmjC.js +0 -14
- package/dist/pairing-store-B171dUVa.js +0 -617
- package/dist/pairing-token-CnyXOU__.js +0 -88
- package/dist/param-readers-CqAoT2n2.js +0 -2
- package/dist/parse-duration-D9q1V0xx.js +0 -41
- package/dist/parse-finite-number-CzdLC_gQ.js +0 -30
- package/dist/parse-json-compat-DfjRYtKX.js +0 -11
- package/dist/parse-log-line-Cd0JHPGg.js +0 -43
- package/dist/parse-port-BFmNhrtE.js +0 -8
- package/dist/parse-timeout-bktz0495.js +0 -27
- package/dist/path-alias-guards-BeOn9PZR.js +0 -40
- package/dist/path-env-C2F1kvna.js +0 -87
- package/dist/path-safety-2mfHCe0n.js +0 -12
- package/dist/paths-Bw8Ci57u.js +0 -2
- package/dist/paths-GWMNxnBn.js +0 -201
- package/dist/paths-xpks599B.js +0 -180
- package/dist/payload-S8niBCaz.js +0 -90
- package/dist/pdf-extract-Cm83kt2M.js +0 -73
- package/dist/perplexity-web-search-provider-Cgr2BYVk.js +0 -423
- package/dist/persistent-bindings.lifecycle-CAOm8v8I.js +0 -159
- package/dist/persistent-dedupe-DoNHVMWs.js +0 -116
- package/dist/pi-embedded-DEAtCIdT.js +0 -40616
- package/dist/pi-embedded-helpers-BVjvCsor.js +0 -1733
- package/dist/pi-embedded.runtime-Ctj3QFs-.js +0 -4
- package/dist/pi-embedded.runtime.js +0 -1
- package/dist/pi-model-discovery-KjI5xf8m.js +0 -188
- package/dist/pi-settings-BJzoHYF9.js +0 -57
- package/dist/pi-tools.before-tool-call.runtime-DJ6s0GDV.js +0 -354
- package/dist/pi-tools.before-tool-call.runtime.js +0 -1
- package/dist/plugin-auto-enable-BZvicayR.js +0 -400
- package/dist/plugin-entry-D0vhddM4.js +0 -25
- package/dist/plugin-entry.runtime-Xd644UDA.js +0 -112
- package/dist/plugin-entry.runtime.js +0 -1
- package/dist/plugin-error-boundary-RI4ByQoA.js +0 -55
- package/dist/plugin-error-handler-DWUTf_UF.js +0 -109
- package/dist/plugin-health-checker-2c6LyJwr.js +0 -125
- package/dist/plugin-hot-reload-CA3__dZN.js +0 -215
- package/dist/plugin-install-BjVLwj7-.js +0 -230
- package/dist/plugin-install-CjwMt13j.js +0 -2
- package/dist/plugin-install-config-policy-MApev-w-.js +0 -93
- package/dist/plugin-install-path-warnings-BkBH-k4n.js +0 -40
- package/dist/plugin-install-plan-0fWhyVBN.js +0 -50
- package/dist/plugin-registry-CORVyKHv.js +0 -74
- package/dist/plugin-registry-Dl1iIh7W.js +0 -2
- package/dist/plugin-runtime-Dd1YN95W.js +0 -6
- package/dist/plugin-sdk/account-core.js +0 -8
- package/dist/plugin-sdk/account-helpers.js +0 -4
- package/dist/plugin-sdk/account-id.js +0 -3
- package/dist/plugin-sdk/account-resolution.js +0 -12
- package/dist/plugin-sdk/acp-runtime.js +0 -3
- package/dist/plugin-sdk/agent-config-primitives.js +0 -3
- package/dist/plugin-sdk/agent-runtime.js +0 -29
- package/dist/plugin-sdk/allow-from.js +0 -5
- package/dist/plugin-sdk/allowlist-config-edit.js +0 -2
- package/dist/plugin-sdk/amazon-bedrock.js +0 -15
- package/dist/plugin-sdk/anthropic-vertex.js +0 -2
- package/dist/plugin-sdk/approval-runtime.js +0 -8
- package/dist/plugin-sdk/bluebubbles-policy.js +0 -2
- package/dist/plugin-sdk/bluebubbles.js +0 -39
- package/dist/plugin-sdk/boolean-param.js +0 -2
- package/dist/plugin-sdk/browser-runtime.js +0 -3
- package/dist/plugin-sdk/browser-support.js +0 -44
- package/dist/plugin-sdk/browser.js +0 -15
- package/dist/plugin-sdk/byteplus.js +0 -17
- package/dist/plugin-sdk/channel-actions.js +0 -3
- package/dist/plugin-sdk/channel-config-helpers.js +0 -2
- package/dist/plugin-sdk/channel-config-primitives.js +0 -4
- package/dist/plugin-sdk/channel-config-schema.js +0 -7
- package/dist/plugin-sdk/channel-config-writes.js +0 -3
- package/dist/plugin-sdk/channel-contract.js +0 -1
- package/dist/plugin-sdk/channel-feedback.js +0 -5
- package/dist/plugin-sdk/channel-inbound.js +0 -10
- package/dist/plugin-sdk/channel-lifecycle.js +0 -3
- package/dist/plugin-sdk/channel-pairing.js +0 -2
- package/dist/plugin-sdk/channel-policy.js +0 -6
- package/dist/plugin-sdk/channel-reply-pipeline.js +0 -2
- package/dist/plugin-sdk/channel-runtime.js +0 -16
- package/dist/plugin-sdk/channel-send-result.js +0 -2
- package/dist/plugin-sdk/channel-setup.js +0 -5
- package/dist/plugin-sdk/channel-status.js +0 -5
- package/dist/plugin-sdk/channel-targets.js +0 -5
- package/dist/plugin-sdk/chutes.js +0 -20
- package/dist/plugin-sdk/cli-backend.js +0 -3
- package/dist/plugin-sdk/cli-runtime.js +0 -7
- package/dist/plugin-sdk/cloudflare-ai-gateway.js +0 -18
- package/dist/plugin-sdk/collection-runtime.js +0 -3
- package/dist/plugin-sdk/command-auth-native.js +0 -6
- package/dist/plugin-sdk/command-auth.js +0 -14
- package/dist/plugin-sdk/command-detection.js +0 -3
- package/dist/plugin-sdk/command-surface.js +0 -3
- package/dist/plugin-sdk/compat.js +0 -35
- package/dist/plugin-sdk/config-runtime.js +0 -25
- package/dist/plugin-sdk/conversation-runtime.js +0 -15
- package/dist/plugin-sdk/core.js +0 -22
- package/dist/plugin-sdk/dangerous-name-runtime.js +0 -3
- package/dist/plugin-sdk/deepseek.js +0 -14
- package/dist/plugin-sdk/device-bootstrap.js +0 -4
- package/dist/plugin-sdk/diagnostic-runtime.js +0 -4
- package/dist/plugin-sdk/diagnostics-otel.js +0 -6
- package/dist/plugin-sdk/diffs.js +0 -4
- package/dist/plugin-sdk/direct-dm.js +0 -2
- package/dist/plugin-sdk/directory-runtime.js +0 -5
- package/dist/plugin-sdk/discord-account.js +0 -2
- package/dist/plugin-sdk/discord-core.js +0 -9
- package/dist/plugin-sdk/discord-runtime-surface.js +0 -2
- package/dist/plugin-sdk/discord-session-key.js +0 -2
- package/dist/plugin-sdk/discord-surface.js +0 -2
- package/dist/plugin-sdk/discord-thread-bindings.js +0 -2
- package/dist/plugin-sdk/discord-timeouts.js +0 -2
- package/dist/plugin-sdk/discord.js +0 -21
- package/dist/plugin-sdk/error-runtime.js +0 -3
- package/dist/plugin-sdk/extension-shared.js +0 -3
- package/dist/plugin-sdk/feishu-conversation.js +0 -2
- package/dist/plugin-sdk/feishu-setup.js +0 -2
- package/dist/plugin-sdk/feishu.js +0 -34
- package/dist/plugin-sdk/fetch-runtime.js +0 -7
- package/dist/plugin-sdk/file-lock.js +0 -2
- package/dist/plugin-sdk/gateway-runtime.js +0 -4
- package/dist/plugin-sdk/github-copilot-login.js +0 -2
- package/dist/plugin-sdk/github-copilot-token.js +0 -3
- package/dist/plugin-sdk/global-singleton.js +0 -4
- package/dist/plugin-sdk/google.js +0 -2
- package/dist/plugin-sdk/googlechat.js +0 -38
- package/dist/plugin-sdk/group-access.js +0 -2
- package/dist/plugin-sdk/hook-runtime.js +0 -4
- package/dist/plugin-sdk/host-runtime.js +0 -4
- package/dist/plugin-sdk/huggingface.js +0 -18
- package/dist/plugin-sdk/image-generation-core.js +0 -63
- package/dist/plugin-sdk/image-generation.js +0 -2
- package/dist/plugin-sdk/index.js +0 -5
- package/dist/plugin-sdk/infra-runtime.js +0 -45
- package/dist/plugin-sdk/interactive-runtime.js +0 -4
- package/dist/plugin-sdk/irc-surface.js +0 -2
- package/dist/plugin-sdk/irc.js +0 -30
- package/dist/plugin-sdk/json-store.js +0 -3
- package/dist/plugin-sdk/keyed-async-queue.js +0 -2
- package/dist/plugin-sdk/kilocode.js +0 -23
- package/dist/plugin-sdk/kimi-coding.js +0 -11
- package/dist/plugin-sdk/lazy-runtime.js +0 -3
- package/dist/plugin-sdk/line-core.js +0 -6
- package/dist/plugin-sdk/line-runtime.js +0 -2
- package/dist/plugin-sdk/line-surface.js +0 -2
- package/dist/plugin-sdk/line.js +0 -9
- package/dist/plugin-sdk/llm-task.js +0 -6
- package/dist/plugin-sdk/logging-core.js +0 -5
- package/dist/plugin-sdk/markdown-table-runtime.js +0 -3
- package/dist/plugin-sdk/matrix-helper.js +0 -2
- package/dist/plugin-sdk/matrix-runtime-heavy.js +0 -5
- package/dist/plugin-sdk/matrix-runtime-shared.js +0 -3
- package/dist/plugin-sdk/matrix-runtime-surface.js +0 -2
- package/dist/plugin-sdk/matrix-surface.js +0 -2
- package/dist/plugin-sdk/matrix-thread-bindings.js +0 -2
- package/dist/plugin-sdk/matrix.js +0 -53
- package/dist/plugin-sdk/mattermost-policy.js +0 -11
- package/dist/plugin-sdk/mattermost.js +0 -41
- package/dist/plugin-sdk/media-runtime.js +0 -17
- package/dist/plugin-sdk/media-understanding-runtime.js +0 -2
- package/dist/plugin-sdk/media-understanding.js +0 -3
- package/dist/plugin-sdk/memory-core-engine-runtime.js +0 -2
- package/dist/plugin-sdk/memory-core-host-engine-embeddings.js +0 -6
- package/dist/plugin-sdk/memory-core-host-engine-foundation.js +0 -17
- package/dist/plugin-sdk/memory-core-host-engine-qmd.js +0 -3
- package/dist/plugin-sdk/memory-core-host-engine-storage.js +0 -4
- package/dist/plugin-sdk/memory-core-host-multimodal.js +0 -3
- package/dist/plugin-sdk/memory-core-host-query.js +0 -3
- package/dist/plugin-sdk/memory-core-host-runtime-cli.js +0 -12
- package/dist/plugin-sdk/memory-core-host-runtime-core.js +0 -14
- package/dist/plugin-sdk/memory-core-host-runtime-files.js +0 -4
- package/dist/plugin-sdk/memory-core-host-secret.js +0 -3
- package/dist/plugin-sdk/memory-core-host-status.js +0 -2
- package/dist/plugin-sdk/memory-core.js +0 -29
- package/dist/plugin-sdk/memory-lancedb.js +0 -4
- package/dist/plugin-sdk/minimax.js +0 -24
- package/dist/plugin-sdk/mistral.js +0 -17
- package/dist/plugin-sdk/models-provider-runtime.js +0 -3
- package/dist/plugin-sdk/modelstudio-definitions.js +0 -19
- package/dist/plugin-sdk/modelstudio.js +0 -24
- package/dist/plugin-sdk/moonshot.js +0 -17
- package/dist/plugin-sdk/msteams.js +0 -46
- package/dist/plugin-sdk/native-command-registry.js +0 -3
- package/dist/plugin-sdk/nextcloud-talk.js +0 -35
- package/dist/plugin-sdk/nostr.js +0 -14
- package/dist/plugin-sdk/nvidia.js +0 -11
- package/dist/plugin-sdk/ollama-surface.js +0 -24
- package/dist/plugin-sdk/ollama.js +0 -2
- package/dist/plugin-sdk/openai.js +0 -2
- package/dist/plugin-sdk/opencode-go.js +0 -14
- package/dist/plugin-sdk/opencode.js +0 -15
- package/dist/plugin-sdk/outbound-runtime.js +0 -5
- package/dist/plugin-sdk/param-readers.js +0 -3
- package/dist/plugin-sdk/plugin-entry.js +0 -3
- package/dist/plugin-sdk/plugin-runtime.js +0 -8
- package/dist/plugin-sdk/process-runtime.js +0 -3
- package/dist/plugin-sdk/provider-auth-api-key.js +0 -9
- package/dist/plugin-sdk/provider-auth-login.js +0 -2
- package/dist/plugin-sdk/provider-auth-result.js +0 -2
- package/dist/plugin-sdk/provider-auth-runtime.js +0 -5
- package/dist/plugin-sdk/provider-auth.js +0 -17
- package/dist/plugin-sdk/provider-catalog-shared.js +0 -2
- package/dist/plugin-sdk/provider-entry.js +0 -2
- package/dist/plugin-sdk/provider-env-vars.js +0 -3
- package/dist/plugin-sdk/provider-http.js +0 -6
- package/dist/plugin-sdk/provider-model-shared.js +0 -5
- package/dist/plugin-sdk/provider-moonshot.js +0 -3
- package/dist/plugin-sdk/provider-onboard.js +0 -3
- package/dist/plugin-sdk/provider-setup.js +0 -3
- package/dist/plugin-sdk/provider-stream.js +0 -4
- package/dist/plugin-sdk/provider-tools.js +0 -2
- package/dist/plugin-sdk/provider-usage.js +0 -3
- package/dist/plugin-sdk/provider-web-fetch.js +0 -6
- package/dist/plugin-sdk/provider-web-search.js +0 -7
- package/dist/plugin-sdk/provider-zai-endpoint.js +0 -2
- package/dist/plugin-sdk/qianfan.js +0 -13
- package/dist/plugin-sdk/reply-chunking.js +0 -4
- package/dist/plugin-sdk/reply-dispatch-runtime.js +0 -5
- package/dist/plugin-sdk/reply-history.js +0 -3
- package/dist/plugin-sdk/reply-payload.js +0 -2
- package/dist/plugin-sdk/reply-runtime.js +0 -14
- package/dist/plugin-sdk/request-url.js +0 -2
- package/dist/plugin-sdk/retry-runtime.js +0 -4
- package/dist/plugin-sdk/root-alias.cjs +0 -347
- package/dist/plugin-sdk/routing.js +0 -9
- package/dist/plugin-sdk/runtime-config-snapshot.js +0 -3
- package/dist/plugin-sdk/runtime-env.js +0 -17
- package/dist/plugin-sdk/runtime-group-policy.js +0 -3
- package/dist/plugin-sdk/runtime-store.js +0 -2
- package/dist/plugin-sdk/runtime.js +0 -9
- package/dist/plugin-sdk/sandbox.js +0 -6
- package/dist/plugin-sdk/secret-input.js +0 -4
- package/dist/plugin-sdk/security-runtime.js +0 -6
- package/dist/plugin-sdk/self-hosted-provider-setup.js +0 -2
- package/dist/plugin-sdk/session-store-runtime.js +0 -4
- package/dist/plugin-sdk/setup-adapter-runtime.js +0 -3
- package/dist/plugin-sdk/setup-runtime.js +0 -6
- package/dist/plugin-sdk/setup-tools.js +0 -6
- package/dist/plugin-sdk/setup.js +0 -13
- package/dist/plugin-sdk/sglang.js +0 -15
- package/dist/plugin-sdk/signal-account.js +0 -2
- package/dist/plugin-sdk/signal-surface.js +0 -2
- package/dist/plugin-sdk/signal.js +0 -24
- package/dist/plugin-sdk/skill-commands-runtime.js +0 -3
- package/dist/plugin-sdk/slack-account.js +0 -2
- package/dist/plugin-sdk/slack-core.js +0 -7
- package/dist/plugin-sdk/slack-runtime-surface.js +0 -2
- package/dist/plugin-sdk/slack-surface.js +0 -2
- package/dist/plugin-sdk/slack-target-parser.js +0 -2
- package/dist/plugin-sdk/slack-targets.js +0 -3
- package/dist/plugin-sdk/slack.js +0 -20
- package/dist/plugin-sdk/speech-core.js +0 -4
- package/dist/plugin-sdk/speech-runtime.js +0 -2
- package/dist/plugin-sdk/speech.js +0 -5
- package/dist/plugin-sdk/ssrf-runtime.js +0 -6
- package/dist/plugin-sdk/state-paths.js +0 -3
- package/dist/plugin-sdk/status-helpers.js +0 -4
- package/dist/plugin-sdk/string-normalization-runtime.js +0 -3
- package/dist/plugin-sdk/synthetic.js +0 -17
- package/dist/plugin-sdk/telegram-account.js +0 -2
- package/dist/plugin-sdk/telegram-allow-from.js +0 -12
- package/dist/plugin-sdk/telegram-command-config.js +0 -3
- package/dist/plugin-sdk/telegram-core.js +0 -18
- package/dist/plugin-sdk/telegram-surface.js +0 -42
- package/dist/plugin-sdk/temp-path.js +0 -4
- package/dist/plugin-sdk/testing.js +0 -11
- package/dist/plugin-sdk/text-runtime.js +0 -19
- package/dist/plugin-sdk/thread-bindings-runtime.js +0 -4
- package/dist/plugin-sdk/thread-ownership.js +0 -5
- package/dist/plugin-sdk/tlon.js +0 -13
- package/dist/plugin-sdk/together.js +0 -16
- package/dist/plugin-sdk/tool-send.js +0 -2
- package/dist/plugin-sdk/twitch.js +0 -8
- package/dist/plugin-sdk/venice.js +0 -16
- package/dist/plugin-sdk/vllm.js +0 -15
- package/dist/plugin-sdk/voice-call.js +0 -7
- package/dist/plugin-sdk/volcengine.js +0 -17
- package/dist/plugin-sdk/web-media.js +0 -4
- package/dist/plugin-sdk/webhook-ingress.js +0 -9
- package/dist/plugin-sdk/webhook-path.js +0 -2
- package/dist/plugin-sdk/webhook-request-guards.js +0 -3
- package/dist/plugin-sdk/whatsapp-auth-presence.js +0 -2
- package/dist/plugin-sdk/whatsapp-core.js +0 -11
- package/dist/plugin-sdk/whatsapp-shared.js +0 -5
- package/dist/plugin-sdk/whatsapp-surface.js +0 -2
- package/dist/plugin-sdk/whatsapp-targets.js +0 -2
- package/dist/plugin-sdk/windows-spawn.js +0 -2
- package/dist/plugin-sdk/xai.js +0 -27
- package/dist/plugin-sdk/zalo-setup.js +0 -2
- package/dist/plugin-sdk/zalo.js +0 -38
- package/dist/plugin-sdk/zalouser.js +0 -29
- package/dist/plugin-sdk/zod.js +0 -3
- package/dist/plugins/build-smoke-entry.js +0 -4
- package/dist/plugins/provider-runtime.runtime.js +0 -2
- package/dist/plugins/runtime/index.js +0 -2
- package/dist/plugins/runtime/runtime-line.contract.js +0 -23
- package/dist/plugins-DcjzAZWt.js +0 -5
- package/dist/plugins-allowlist-DoZlIC4p.js +0 -14
- package/dist/plugins-cli-G6GhHHD0.js +0 -561
- package/dist/plugins-command-helpers-CIYzoC65.js +0 -116
- package/dist/plugins-install-persist-C5-bJdRb.js +0 -121
- package/dist/plugins-update-command-CsT_saJm.js +0 -974
- package/dist/plugins-w6xUzHby.js +0 -40
- package/dist/pluralkit-B_DWQnc5.js +0 -21
- package/dist/pluralkit-Bez5QVFC.js +0 -2
- package/dist/policy-D6OQdw73.js +0 -173
- package/dist/policy-DXeeH8B2.js +0 -147
- package/dist/poll-params-DTVSSuok.js +0 -52
- package/dist/polls-CMmT0F_y.js +0 -35
- package/dist/port-defaults-Dajs4Obu.js +0 -30
- package/dist/ports-DuU-A86K.js +0 -262
- package/dist/ports-ZA1n2It7.js +0 -432
- package/dist/ports-lsof-Cw_6T7ru.js +0 -25
- package/dist/ports-probe-DeuK48Pq.js +0 -14
- package/dist/preflight-audio-DTSBExi8.js +0 -48
- package/dist/preflight-audio.runtime-BJRLyBvf.js +0 -7
- package/dist/preflight-audio.runtime.js +0 -1
- package/dist/prepare-BQBndJUC.js +0 -1301
- package/dist/probe-BO4hbHvs.js +0 -435
- package/dist/probe-DPv2pfj5.js +0 -1868
- package/dist/probe-DlO2Q9rN.js +0 -170
- package/dist/probe-RbbTQOHx.js +0 -178
- package/dist/probe-auth-Bl9MHtlP.js +0 -2
- package/dist/probe-auth-CUfEH7di.js +0 -63
- package/dist/probe-eYLpFww_.js +0 -137
- package/dist/probe-kfBMuOWF.js +0 -2
- package/dist/probe-wktb4WTP.js +0 -349
- package/dist/probe.runtime-BhbUesak.js +0 -2
- package/dist/probe.runtime.js +0 -1
- package/dist/process-runtime-CBFMzhIk.js +0 -2
- package/dist/process-scoped-map-C7IoOrV-.js +0 -61
- package/dist/profile-B5n9yLlB.js +0 -2
- package/dist/profile-CmsqnPsu.js +0 -107
- package/dist/profile-update-D6f10CZk.js +0 -67
- package/dist/profile-utils-C7uzTwgJ.js +0 -15
- package/dist/profiles-BoNergZo.js +0 -79
- package/dist/program-BuKG0Ntx.js +0 -158
- package/dist/program-context-DDmlbmbl.js +0 -2
- package/dist/program-context-DQOnR5c_.js +0 -10
- package/dist/progress-DQvXYKne.js +0 -132
- package/dist/prompt-COzf5LIJ.js +0 -2
- package/dist/prompt-OSmU-o7R.js +0 -20
- package/dist/prompt-select-styled-yYL3el77.js +0 -6432
- package/dist/prompt-style-DekFM6h7.js +0 -7
- package/dist/prompts-MtRTsZpw.js +0 -9
- package/dist/prototype-keys-DrjhYNcz.js +0 -11
- package/dist/provider-BWTXmDq3.js +0 -3685
- package/dist/provider-BrmcrkEe.js +0 -70
- package/dist/provider-ByBRbhW5.js +0 -7216
- package/dist/provider-api-key-auth-BcyipSdy.js +0 -109
- package/dist/provider-api-key-auth.runtime-BRu_8L4m.js +0 -14
- package/dist/provider-api-key-auth.runtime.js +0 -1
- package/dist/provider-attribution-DMVujx9B.js +0 -285
- package/dist/provider-auth-DK2UmYsZ.js +0 -43
- package/dist/provider-auth-api-key-99KxscjW.js +0 -5
- package/dist/provider-auth-choice-GbHta8Bp.js +0 -134
- package/dist/provider-auth-choice-helpers-CO2MnSGR.js +0 -58
- package/dist/provider-auth-choice-preference-DvAqSMGK.js +0 -44
- package/dist/provider-auth-choice.runtime-B8R63sLq.js +0 -14
- package/dist/provider-auth-choice.runtime-DypTKgMQ.js +0 -2
- package/dist/provider-auth-choice.runtime.js +0 -1
- package/dist/provider-auth-choices-n-JV1XgU.js +0 -65
- package/dist/provider-auth-guidance-DAB9sGGR.js +0 -35
- package/dist/provider-auth-helpers-gmTAji1W.js +0 -92
- package/dist/provider-auth-input-GgY_tjJh.js +0 -116
- package/dist/provider-auth-login-BYbccnB1.js +0 -8
- package/dist/provider-auth-login.runtime-DnSxCwqU.js +0 -196
- package/dist/provider-auth-login.runtime.js +0 -1
- package/dist/provider-auth-mode-Dbja5LLX.js +0 -20
- package/dist/provider-auth-ref-BErMfwCd.js +0 -171
- package/dist/provider-auth-ref-DEF_hE2R.js +0 -2
- package/dist/provider-auth-result-DiUxDF1G.js +0 -31
- package/dist/provider-auth-runtime-BwMq9oMD.js +0 -32
- package/dist/provider-catalog--Qc0q0I-.js +0 -26
- package/dist/provider-catalog-A_s8JQaq.js +0 -18
- package/dist/provider-catalog-B-EcLvBI.js +0 -11
- package/dist/provider-catalog-Bte-HucL.js +0 -44
- package/dist/provider-catalog-C63Rfat7.js +0 -11
- package/dist/provider-catalog-C7q0Vb3S.js +0 -95
- package/dist/provider-catalog-CCnuf8d3.js +0 -49
- package/dist/provider-catalog-CYQ7k_Db.js +0 -48
- package/dist/provider-catalog-CnlB2mMZ.js +0 -11
- package/dist/provider-catalog-CoyAbDZX.js +0 -56
- package/dist/provider-catalog-CtqhFopw.js +0 -48
- package/dist/provider-catalog-CyGxB_aR.js +0 -18
- package/dist/provider-catalog-D1pmWiDQ.js +0 -48
- package/dist/provider-catalog-DGgsalJv.js +0 -12
- package/dist/provider-catalog-DLdTTMmW.js +0 -11
- package/dist/provider-catalog-DZzX7Vwk.js +0 -54
- package/dist/provider-catalog-J2dZciKS.js +0 -11
- package/dist/provider-catalog-LVrcrz-W.js +0 -36
- package/dist/provider-catalog-aIN0QojF.js +0 -11
- package/dist/provider-catalog-shared-Db9nbr1B.js +0 -28
- package/dist/provider-discovery.runtime-BCUAsMMz.js +0 -10
- package/dist/provider-discovery.runtime.js +0 -1
- package/dist/provider-dispatcher-COxXbow_.js +0 -22
- package/dist/provider-entry-CT_YeII_.js +0 -86
- package/dist/provider-env-vars-4Bon7Y2X.js +0 -121
- package/dist/provider-env-vars-Np7qkDjC.js +0 -2
- package/dist/provider-flow-Dlg1GcXQ.js +0 -93
- package/dist/provider-http-DQQ317hc.js +0 -3
- package/dist/provider-id-CHzLB538.js +0 -30
- package/dist/provider-model-defaults-dSPzPas0.js +0 -5
- package/dist/provider-model-primary-D8SgLcOd.js +0 -26
- package/dist/provider-model-shared-GO1WT2fY.js +0 -104
- package/dist/provider-models-BG8YwJaY.js +0 -117
- package/dist/provider-models-BVVCdM8F.js +0 -22
- package/dist/provider-models-D2UZvTo3.js +0 -46
- package/dist/provider-moonshot-Cl8urWHL.js +0 -2
- package/dist/provider-oauth-flow-Bu2gIeX6.js +0 -33
- package/dist/provider-onboard-CTEHTjfw.js +0 -264
- package/dist/provider-openai-codex-oauth-tls-DdLUDuIM.js +0 -101
- package/dist/provider-registry-Ljtt6CKE.js +0 -49
- package/dist/provider-request-config-CIrbwAnR.js +0 -209
- package/dist/provider-runtime-BBFXlsU0.js +0 -2
- package/dist/provider-runtime-D_itmv9t.js +0 -291
- package/dist/provider-runtime.runtime-B_oC992d.js +0 -26
- package/dist/provider-runtime.runtime.js +0 -1
- package/dist/provider-self-hosted-setup-BlNrSREL.js +0 -272
- package/dist/provider-session.runtime-DQyRV-t3.js +0 -7
- package/dist/provider-session.runtime.js +0 -1
- package/dist/provider-setup-CSrOyU04.js +0 -2
- package/dist/provider-stream-m5D8QZPz.js +0 -289
- package/dist/provider-tools-NuJzTqa1.js +0 -37
- package/dist/provider-usage-BB5mQ8Fg.js +0 -3
- package/dist/provider-usage-CbPs3eFQ.js +0 -2
- package/dist/provider-usage-DG1gff_M.js +0 -375
- package/dist/provider-usage.fetch-DHWQ4YZu.js +0 -633
- package/dist/provider-web-fetch-QzED2vth.js +0 -5
- package/dist/provider-web-search-CVMEZcl8.js +0 -306
- package/dist/provider-wizard-B0ocsg3q.js +0 -209
- package/dist/provider-zai-endpoint-DoIy5HQf.js +0 -116
- package/dist/provider.runtime-jHt6447e.js +0 -2
- package/dist/provider.runtime.js +0 -1
- package/dist/providers-DUy2TaM-.js +0 -59
- package/dist/providers.runtime-Bz0X8DZ2.js +0 -60
- package/dist/providers.runtime.js +0 -1
- package/dist/proxy-env-D4H9qI5l.js +0 -40
- package/dist/proxy-fetch-DiyTLcAR.js +0 -55
- package/dist/proxy-hcRRmsDd.js +0 -121
- package/dist/pw-ai-Cp64-UGh.js +0 -2037
- package/dist/qmd-manager-D2rMomsU.js +0 -1740
- package/dist/qr-cli-DuANCi-n.js +0 -2
- package/dist/qr-cli-lr5CcLr8.js +0 -367
- package/dist/qr-image-DOcoqAUw.js +0 -2
- package/dist/query-expansion-85HlYbKD.js +0 -633
- package/dist/queue-CtO0M_P1.js +0 -663
- package/dist/reaction-runtime-api-B4KmfKtJ.js +0 -114
- package/dist/reactions-5N2KSGJ2.js +0 -258
- package/dist/read-only-account-inspect-Y_ijOKJ3.js +0 -9
- package/dist/read-only-account-inspect.telegram-BSjjDWnM.js +0 -202
- package/dist/reasoning-tags-CAmbBXLr.js +0 -77
- package/dist/recovery-key-store-DqgdfMc7.js +0 -283
- package/dist/redact-BDinS1q9.js +0 -102
- package/dist/redact-identifier-S69DDJn1.js +0 -13
- package/dist/redact-sensitive-url-CAJSZ_7g.js +0 -50
- package/dist/redirect-headers-CGxONG_L.js +0 -25
- package/dist/ref-contract-CC5BLDoS.js +0 -53
- package/dist/region-BFGEM88n.js +0 -62
- package/dist/register-lazy-command-D6EEI-zz.js +0 -43
- package/dist/register.agent-D1eKwVU7.js +0 -239
- package/dist/register.backup-S8hwHpZL.js +0 -236
- package/dist/register.configure-CJrQ3u9y.js +0 -15
- package/dist/register.maintenance-BrKWl7_D.js +0 -449
- package/dist/register.message-BCWJfH2h.js +0 -642
- package/dist/register.onboard-zzNq0pJS.js +0 -79
- package/dist/register.setup-BLQwDKzc.js +0 -104
- package/dist/register.status-health-sessions-B4TUEudf.js +0 -1206
- package/dist/register.subclis-B0pG22H2.js +0 -295
- package/dist/register.subclis-BEM0mzJb.js +0 -3
- package/dist/registry-ByjnKj3u.js +0 -219
- package/dist/registry-CuFNdbH5.js +0 -60
- package/dist/registry-DvqOrcbF.js +0 -675
- package/dist/registry-mVzzlPf7.js +0 -50
- package/dist/repair-IMBZnz-L.js +0 -112
- package/dist/replies-BCoZ2HxY.js +0 -118
- package/dist/reply-D8bUQd-Q.js +0 -3176
- package/dist/reply-blocks-CjCUTZru.js +0 -103
- package/dist/reply-chunking-CxFd5izq.js +0 -3
- package/dist/reply-dispatch-runtime-Bk9RDzB9.js +0 -3
- package/dist/reply-history-DtTaPEgt.js +0 -2
- package/dist/reply-payload-CRYI4jIB.js +0 -232
- package/dist/reply-payloads-CQXH7ury.js +0 -116
- package/dist/reply-payloads-dedupe-BKObDjVe.js +0 -135
- package/dist/reply-payloads-dedupe.runtime-SbVNMvEs.js +0 -2
- package/dist/reply-payloads-dedupe.runtime.js +0 -1
- package/dist/reply-prefix-Eema_xXG.js +0 -39
- package/dist/reply-runtime-DUrpJTzu.js +0 -123
- package/dist/reply.runtime-Cdb_6NI1.js +0 -2
- package/dist/reply.runtime.js +0 -1
- package/dist/request-url-B8k-YRRH.js +0 -10
- package/dist/resolve-C3pJ2gj_.js +0 -174
- package/dist/resolve-C_pCWwC0.js +0 -619
- package/dist/resolve-allowlist-HrJ_3icS.js +0 -147
- package/dist/resolve-cbCi7mbs.js +0 -2
- package/dist/resolve-channels-BTyErRev.js +0 -226
- package/dist/resolve-channels-DvV-fUQv.js +0 -263
- package/dist/resolve-configured-secret-input-string-BasQGOd9.js +0 -112
- package/dist/resolve-route-EE8E7OAF.js +0 -486
- package/dist/resolve-system-bin-TC907QYo.js +0 -120
- package/dist/resolve-targets-B1MvBWpT.js +0 -280
- package/dist/resolve-users-BfVoBZG_.js +0 -145
- package/dist/resolve-utils-ClmKSkEQ.js +0 -102
- package/dist/response-generator-ACP21F1j.js +0 -153
- package/dist/response-prefix-template-Cp4tg6Qw.js +0 -50
- package/dist/restart-sentinel-B3EigRIb.js +0 -70
- package/dist/restart-stale-pids-dsB3eE6_.js +0 -187
- package/dist/retry-CIAqcw7C.js +0 -76
- package/dist/retry-policy-BJ5Q68It.js +0 -58
- package/dist/retry-runtime-Cbu5zDnX.js +0 -3
- package/dist/rooms-B1IyUfuR.js +0 -325
- package/dist/root-help-Bwa-vlhy.js +0 -53
- package/dist/route-reply-bC07YRDb.js +0 -133
- package/dist/route-reply.runtime-dS2XMwkv.js +0 -2
- package/dist/route-reply.runtime.js +0 -1
- package/dist/route-resolution-DQHmIfWN.js +0 -461
- package/dist/routes-CWXihJFR.js +0 -6884
- package/dist/routing-BVt9nMN-.js +0 -16
- package/dist/rpc-5eaI-FsF.js +0 -67
- package/dist/rpc-context-Dimdo4io.js +0 -155
- package/dist/run-command-2jxKF1a6.js +0 -32
- package/dist/run-main-BKeNUaXq.js +0 -425
- package/dist/run-with-concurrency-DGLkItan.js +0 -41
- package/dist/runner-COmi-bB0.js +0 -1479
- package/dist/runs-CX-70k4f.js +0 -616
- package/dist/runtime-1phb9iVo.js +0 -6
- package/dist/runtime-B8hqEtu6.js +0 -181
- package/dist/runtime-BpHrcXgA.js +0 -5
- package/dist/runtime-BscSIjIL.js +0 -126
- package/dist/runtime-C8qvwPYG.js +0 -286
- package/dist/runtime-CBX_rq4O.js +0 -18
- package/dist/runtime-CC1YDOst.js +0 -5
- package/dist/runtime-CIE7xJwu.js +0 -5
- package/dist/runtime-CNZi_czi.js +0 -42
- package/dist/runtime-CPw-0dWW.js +0 -5
- package/dist/runtime-DXdxDbJm.js +0 -102
- package/dist/runtime-DofOSZ5U.js +0 -2153
- package/dist/runtime-api-B4Zb5p1_.js +0 -2
- package/dist/runtime-api-BB2RZPnq.js +0 -2
- package/dist/runtime-api-BJnw1_pK.js +0 -2
- package/dist/runtime-api-BTf2rLCn.js +0 -2
- package/dist/runtime-api-BTgAUySz.js +0 -2
- package/dist/runtime-api-BVftCkYc.js +0 -2484
- package/dist/runtime-api-BWaVsvsK.js +0 -14
- package/dist/runtime-api-BXlE282E.js +0 -2
- package/dist/runtime-api-Ba7wWBWO.js +0 -1
- package/dist/runtime-api-BfZqvwkY.js +0 -2
- package/dist/runtime-api-Bja3afzd.js +0 -3676
- package/dist/runtime-api-C7cX3f2r.js +0 -2
- package/dist/runtime-api-CCKblcQO.js +0 -81
- package/dist/runtime-api-CEmQSooZ.js +0 -2
- package/dist/runtime-api-CWQMIahu.js +0 -241
- package/dist/runtime-api-Ch1E1gvT.js +0 -2
- package/dist/runtime-api-CjgyJEjn.js +0 -2
- package/dist/runtime-api-CuqnElJG.js +0 -3
- package/dist/runtime-api-DOyNJNHi.js +0 -2
- package/dist/runtime-api-DUbp7oPz.js +0 -2
- package/dist/runtime-api-DZDDizAj.js +0 -1
- package/dist/runtime-api-DZcQIyI0.js +0 -1
- package/dist/runtime-api-Di-XE7J4.js +0 -3
- package/dist/runtime-api-Dq7rdsm6.js +0 -2
- package/dist/runtime-api-DxO7sIvA.js +0 -120
- package/dist/runtime-api-Dzz1aWyq.js +0 -29
- package/dist/runtime-api-_dg5Me1l.js +0 -2
- package/dist/runtime-config-snapshot-DqWNFIej.js +0 -2
- package/dist/runtime-d8L2hZ57.js +0 -5
- package/dist/runtime-discord-ops.runtime-C2o0995d.js +0 -25
- package/dist/runtime-discord-ops.runtime.js +0 -1
- package/dist/runtime-embedded-pi.runtime-Bk8vHdbc.js +0 -2
- package/dist/runtime-embedded-pi.runtime.js +0 -1
- package/dist/runtime-entry-BypP0hpR.js +0 -4925
- package/dist/runtime-env-SHKgcATc.js +0 -9
- package/dist/runtime-forwarders-ev8FdVyV.js +0 -44
- package/dist/runtime-group-policy-DXJJCWpk.js +0 -1
- package/dist/runtime-group-policy-zTp8fKRK.js +0 -59
- package/dist/runtime-guard-78ESz4Qy.js +0 -70
- package/dist/runtime-kS8e4c6-.js +0 -125
- package/dist/runtime-media-understanding.runtime-CpPWzWdQ.js +0 -2
- package/dist/runtime-media-understanding.runtime.js +0 -1
- package/dist/runtime-model-auth.runtime-1Gsp1j1n.js +0 -2
- package/dist/runtime-model-auth.runtime.js +0 -1
- package/dist/runtime-parse-vvG9x7Ps.js +0 -83
- package/dist/runtime-paths-NiQSNveu.js +0 -305
- package/dist/runtime-plugin-boundary-CzRNh2jW.js +0 -65
- package/dist/runtime-schema-uKXWjWrD.js +0 -14440
- package/dist/runtime-slack-ops.runtime-MQwSRdp3.js +0 -15
- package/dist/runtime-slack-ops.runtime.js +0 -1
- package/dist/runtime-status-2omGgKaM.js +0 -109
- package/dist/runtime-status-Cc383GkB.js +0 -15
- package/dist/runtime-store-CT3yRBe_.js +0 -22
- package/dist/runtime-tts.runtime-DTfPYn3H.js +0 -2
- package/dist/runtime-tts.runtime.js +0 -1
- package/dist/runtime-uvckmk15.js +0 -68
- package/dist/runtime-web-tools-Cf6BXnCm.js +0 -2042
- package/dist/runtime-whatsapp-boundary-Bs8RrKxP.js +0 -139
- package/dist/runtime-whatsapp-boundary-C5mx67ac.js +0 -2
- package/dist/safe-regex-tLlDZYfM.js +0 -244
- package/dist/safe-text-DhIQbZid.js +0 -16
- package/dist/sandbox-DkZ4-LBj.js +0 -4
- package/dist/sandbox-cli-Cho_k3dA.js +0 -443
- package/dist/sandbox-f4-hZNCj.js +0 -2710
- package/dist/sandbox-paths-Br54mtAJ.js +0 -146
- package/dist/sanitize-env-vars-BpNLWkzd.js +0 -82
- package/dist/scan-paths-Bln7l19-.js +0 -28
- package/dist/schema-validator-DofqBvJi.js +0 -176
- package/dist/scoped-expiring-id-cache-C8wyKEV-.js +0 -35
- package/dist/scp-host-B9NPcVwn.js +0 -62
- package/dist/sdk-Ba91_ru8.js +0 -1108
- package/dist/searxng-search-provider-CUEJoeaQ.js +0 -220
- package/dist/secret-equal-fMR1DjSl.js +0 -9
- package/dist/secret-file-BNKBIds0.js +0 -11
- package/dist/secret-file-DwDmPLSX.js +0 -92
- package/dist/secret-input-4MqmO__N.js +0 -13
- package/dist/secret-input-Bqf5ho4v.js +0 -38
- package/dist/secret-input-DyzcNLLY.js +0 -2
- package/dist/secrets-cli-DAP4hi4r.js +0 -2112
- package/dist/secure-random-Diy9rj1m.js +0 -20
- package/dist/security-cli-2WQVKZ3w.js +0 -477
- package/dist/security-runtime-BSQDlFPi.js +0 -55
- package/dist/semver-compare-DkYCMcwG.js +0 -53
- package/dist/send--GwzHbbI.js +0 -100
- package/dist/send-4ZItW1GB.js +0 -3
- package/dist/send-B1YVZR_q.js +0 -1076
- package/dist/send-B6AgLKhw.js +0 -178
- package/dist/send-CAosrV3E.js +0 -2
- package/dist/send-CTHiX-WN.js +0 -442
- package/dist/send-CywIIzow.js +0 -318
- package/dist/send-DZ2VaVTD.js +0 -856
- package/dist/send-deps-Cuc-dTy5.js +0 -19
- package/dist/send-policy-Dz5lteoO.js +0 -60
- package/dist/send-q09VUMe3.js +0 -532
- package/dist/send.components-Cbi5ixnJ.js +0 -844
- package/dist/send.components-dLe6ppiS.js +0 -2
- package/dist/server-BRW1HQ2M.js +0 -67
- package/dist/server-Clq20rV8.js +0 -27990
- package/dist/server-middleware-Ubw3OFd1.js +0 -108
- package/dist/server-node-events-kgWhdE2I.js +0 -454
- package/dist/server-startup-matrix-migration-DJZgJiUa.js +0 -1348
- package/dist/service-2O78fADl.js +0 -867
- package/dist/service-BCUDr0mF.js +0 -2
- package/dist/session-BIwHn1FL.js +0 -137
- package/dist/session-BJudz6Rb.js +0 -50
- package/dist/session-archive.runtime-8FrIp7MP.js +0 -2
- package/dist/session-archive.runtime.js +0 -1
- package/dist/session-binding-service-D7bUc7mS.js +0 -421
- package/dist/session-context-DbS6R7x0.js +0 -23
- package/dist/session-conversation-5Z-WApq_.js +0 -15
- package/dist/session-conversation-BC-SPGma.js +0 -135
- package/dist/session-conversation-D-Olnomz.js +0 -27
- package/dist/session-cost-usage-5iS5N1Rs.js +0 -651
- package/dist/session-cost-usage-ibiGeH7Z.js +0 -2
- package/dist/session-envelope-RE_1D3fZ.js +0 -18
- package/dist/session-errors-CoC2qhLC.js +0 -63
- package/dist/session-file-CnTnoAyl.js +0 -120
- package/dist/session-fork.runtime-Bb9nNLwX.js +0 -50
- package/dist/session-fork.runtime.js +0 -1
- package/dist/session-hooks-D4zcaOKV.js +0 -109
- package/dist/session-key-CQMUjsSp.js +0 -52
- package/dist/session-key-Do__tq1E.js +0 -279
- package/dist/session-key-normalization-BamCBtxj.js +0 -22
- package/dist/session-override-CHm5auQy.js +0 -100
- package/dist/session-reset-model.runtime-DD5SooaH.js +0 -119
- package/dist/session-reset-model.runtime.js +0 -1
- package/dist/session-route-O1Pb7Oid.js +0 -91
- package/dist/session-store-runtime-ePmbOWO1.js +0 -2
- package/dist/session-subagent-reactivation.runtime-BwUDVflj.js +0 -2
- package/dist/session-subagent-reactivation.runtime.js +0 -1
- package/dist/session-transcript-files.fs-CyBs2u56.js +0 -149
- package/dist/session-updates-C33bkLCm.js +0 -222
- package/dist/session-updates.runtime-BHLQJ71D.js +0 -2
- package/dist/session-updates.runtime.js +0 -1
- package/dist/session-utils-C0HJP9m_.js +0 -1743
- package/dist/session-write-lock-C7svKLqX.js +0 -343
- package/dist/sessions-CkaONOVi.js +0 -224
- package/dist/sessions-Dqj9fL_x.js +0 -2
- package/dist/sessions-j2hbBGOS.js +0 -443
- package/dist/setup-0GrDtpRN.js +0 -427
- package/dist/setup-BrOJEPVN.js +0 -15
- package/dist/setup-adapter-runtime-CyIIvoms.js +0 -2
- package/dist/setup-api-1P88M5pV.js +0 -2
- package/dist/setup-binary-CXmsVXWb.js +0 -2
- package/dist/setup-bootstrap-QdrIAyis.js +0 -54
- package/dist/setup-core-BqPbreVF.js +0 -256
- package/dist/setup-core-CFzSqpD7.js +0 -256
- package/dist/setup-core-DJHWTJKX.js +0 -383
- package/dist/setup-core-DT1fK9yD.js +0 -146
- package/dist/setup-core-kjYyNYvv.js +0 -48
- package/dist/setup-core-t03VZdcn.js +0 -160
- package/dist/setup-group-access-BQbnTk8B.js +0 -70
- package/dist/setup-helpers-0yWIq2cW.js +0 -390
- package/dist/setup-runtime-BChXvJOO.js +0 -4
- package/dist/setup-surface-B8loJ-nJ.js +0 -272
- package/dist/setup-surface-BKizDP2g.js +0 -237
- package/dist/setup-surface-BOd4V0w5.js +0 -261
- package/dist/setup-surface-BaLQtvFW.js +0 -353
- package/dist/setup-surface-Bha7U86Z.js +0 -72
- package/dist/setup-surface-BkHkduRm.js +0 -450
- package/dist/setup-surface-CDfudYpT2.js +0 -261
- package/dist/setup-surface-CT-Erp53.js +0 -346
- package/dist/setup-surface-Co1jSLDk.js +0 -656
- package/dist/setup-surface-D0joW4q1.js +0 -333
- package/dist/setup-surface-D9rWJb4Z.js +0 -1447
- package/dist/setup-surface-D_CJfyJ1.js +0 -381
- package/dist/setup-surface-DbVJ8CAj.js +0 -484
- package/dist/setup-surface-Di1q12ha.js +0 -97
- package/dist/setup-surface-LWupQ_eL.js +0 -304
- package/dist/setup-tools-Cb6PLN3L.js +0 -4
- package/dist/setup-wizard-helpers-CA5yiprq.js +0 -841
- package/dist/setup-wizard-proxy-bmMo6OPA.js +0 -127
- package/dist/setup.finalize-DvGlwfbU.js +0 -443
- package/dist/setup.gateway-config-D_eSo_Jz.js +0 -246
- package/dist/setup.secret-input-BAQnay16.js +0 -25
- package/dist/shared-1nXP7RAM.js +0 -78
- package/dist/shared-6u4-kP5J.js +0 -221
- package/dist/shared-BnSR7joQ.js +0 -144
- package/dist/shared-BsLpgVLV.js +0 -37
- package/dist/shared-C-PSF7Rv.js +0 -64
- package/dist/shared-C1MrVu4M.js +0 -180
- package/dist/shared-CA8QQ_O5.js +0 -94
- package/dist/shared-CCV62W5K.js +0 -2
- package/dist/shared-CHJjz6Zz.js +0 -72
- package/dist/shared-CK49TKED.js +0 -50
- package/dist/shared-CL7I4ij0.js +0 -160
- package/dist/shared-Cr7ijuS4.js +0 -198
- package/dist/shared-D61IX915.js +0 -10
- package/dist/shared-Dr9OQu4c.js +0 -64
- package/dist/shared-DwxV-O-g.js +0 -136
- package/dist/shared-dWHdeoyy.js +0 -126
- package/dist/shared-runtime-yV5uP0IO.js +0 -7
- package/dist/shell-argv-B9p91CMW.js +0 -72
- package/dist/shell-env-BTztt4a1.js +0 -181
- package/dist/signal-B1kD3iF3.js +0 -46
- package/dist/signal-DP8FUJOa.js +0 -6
- package/dist/signal-Dvmeol77.js +0 -13
- package/dist/signal-account-CYKnyxZK.js +0 -11
- package/dist/signal-cli-install-DcmsRDbB.js +0 -188
- package/dist/signal-surface-AbofIH7s.js +0 -21
- package/dist/simple-completion-transport-Dl5DzRWP.js +0 -24
- package/dist/skill-commands-CH4lfyW8.js +0 -77
- package/dist/skill-commands-base-CvVjZByy.js +0 -60
- package/dist/skill-commands-runtime-zpWkVBay.js +0 -2
- package/dist/skill-commands.runtime-BKa5oyH-.js +0 -2
- package/dist/skill-commands.runtime.js +0 -1
- package/dist/skill-scanner-bqroDZTs.js +0 -354
- package/dist/skills-D0K7gu2V.js +0 -972
- package/dist/skills-DFTLIGCd.js +0 -4
- package/dist/skills-clawhub-KJGw0uGT.js +0 -274
- package/dist/skills-cli-DziAPxba.js +0 -369
- package/dist/skills-install-CQeO3Sll.js +0 -819
- package/dist/skills-remote-BojLLDxp.js +0 -584
- package/dist/skills-status-BINZ_svK.js +0 -2
- package/dist/skills-status-CdQUttuP.js +0 -170
- package/dist/slack-BuMSbx3k.js +0 -6
- package/dist/slack-DMg3O5YT.js +0 -9
- package/dist/slack-account-LEbfbXys.js +0 -11
- package/dist/slack-core-oqCiyGw8.js +0 -4
- package/dist/slack-runtime-surface-CyaeT7yk.js +0 -18
- package/dist/slack-surface-1yTIS5Q8.js +0 -44
- package/dist/slack-target-parser-CruIJ5w5.js +0 -12
- package/dist/slack-targets-ukxuKR1I.js +0 -45
- package/dist/slash-commands-CRuXC74L.js +0 -672
- package/dist/slash-commands.runtime-F6b9KUnh.js +0 -20
- package/dist/slash-commands.runtime.js +0 -1
- package/dist/slash-dispatch.runtime-CItGyoBF.js +0 -38
- package/dist/slash-dispatch.runtime.js +0 -1
- package/dist/slash-skill-commands.runtime-Caw0oNvV.js +0 -8
- package/dist/slash-skill-commands.runtime.js +0 -1
- package/dist/slots-Dq-2eIRb.js +0 -93
- package/dist/speech-Ceb4ISD4.js +0 -46
- package/dist/speech-provider-BHjDbut-.js +0 -190
- package/dist/speech-provider-D45m9grJ.js +0 -154
- package/dist/speech-provider-DM1ZXsz2.js +0 -385
- package/dist/speech-runtime-CNvOkPw4.js +0 -34
- package/dist/src-Dn1TYXp6.js +0 -2739
- package/dist/ssh-config-C1ipLHgq.js +0 -77
- package/dist/ssh-tunnel-BwMCLc2e.js +0 -159
- package/dist/ssh-tunnel-D5YdH2SQ.js +0 -2
- package/dist/ssrf-Duye12M_.js +0 -246
- package/dist/ssrf-policy-5L7qS2kK.js +0 -69
- package/dist/ssrf-runtime-bpDM5Bgo.js +0 -5
- package/dist/stable-node-path-n7TARbHZ.js +0 -32
- package/dist/stage-sandbox-media.runtime-Tlgx4F6M.js +0 -229
- package/dist/stage-sandbox-media.runtime.js +0 -1
- package/dist/stagger-Cs-6sySM.js +0 -54
- package/dist/startup-verification-DS8Rlwfj.js +0 -131
- package/dist/state-migrations-ssGF0Trg.js +0 -845
- package/dist/state-paths-LoYjHd5L.js +0 -2
- package/dist/status-B7yRr4OV.js +0 -3
- package/dist/status-BM1Lyqo6.js +0 -261
- package/dist/status-BekOC_tW.js +0 -650
- package/dist/status-CxodlqzZ.js +0 -2
- package/dist/status-DHbl5eIj.js +0 -608
- package/dist/status-PsQV2sfU.js +0 -44
- package/dist/status-all-C53a3881.js +0 -798
- package/dist/status-helpers-CCJSSrVJ.js +0 -170
- package/dist/status-issues-M-RUxHvm.js +0 -336
- package/dist/status-issues-qWKbW6r2.js +0 -187
- package/dist/status-json-B66tF12J.js +0 -86
- package/dist/status.agent-local-B8Sw_p6M.js +0 -59
- package/dist/status.command.text-runtime-csZS5yHm.js +0 -18
- package/dist/status.daemon-D0GzvHft.js +0 -25
- package/dist/status.format-C1VNrTBi.js +0 -44
- package/dist/status.gateway-probe-4INUEsUo.js +0 -15
- package/dist/status.link-channel-CJtR5UX6.js +0 -35
- package/dist/status.node-mode-Bva3wbBI.js +0 -2
- package/dist/status.node-mode-CneoXHPW.js +0 -32
- package/dist/status.scan-t1kfm4e0.js +0 -264
- package/dist/status.scan.deps.runtime-CCaTJlzV.js +0 -18
- package/dist/status.scan.deps.runtime.js +0 -1
- package/dist/status.scan.fast-json-DmzN3HuU.js +0 -97
- package/dist/status.scan.fast-json-gu6uL_BR.js +0 -2
- package/dist/status.scan.json-core-JjMIy9YZ.js +0 -254
- package/dist/status.scan.runtime-r_5mTC8f.js +0 -9
- package/dist/status.scan.runtime.js +0 -1
- package/dist/status.service-summary-DnbDBXMs.js +0 -32
- package/dist/status.summary-CbEhZE0h.js +0 -210
- package/dist/status.summary-SLm6uT22.js +0 -2
- package/dist/status.update-Bw9CvcCc.js +0 -2
- package/dist/status.update-CLnevxJb.js +0 -79
- package/dist/sticker-cache-C_FrWgaA.js +0 -1573
- package/dist/sticker-vision.runtime-DR7e08nD.js +0 -16
- package/dist/sticker-vision.runtime.js +0 -1
- package/dist/storage-CPQLpmgN.js +0 -234
- package/dist/storage-paths-DvC4vQo1.js +0 -51
- package/dist/store-8ONMiMTI.js +0 -365
- package/dist/store-DQJZr0Yf.js +0 -767
- package/dist/store-Dxcm2vsw.js +0 -140
- package/dist/store-_OZh8RrM.js +0 -1343
- package/dist/store-read-JHUhrL0Z.js +0 -16
- package/dist/store.runtime-Dmqv-8M7.js +0 -2
- package/dist/store.runtime.js +0 -1
- package/dist/stream-CGrFe0j0.js +0 -123
- package/dist/stream-D9HOuZmn.js +0 -633
- package/dist/stream-Di_JOWoE.js +0 -180
- package/dist/stream-wrappers-D-DlMIYG.js +0 -136
- package/dist/string-normalization-Ddc4JXRe.js +0 -19
- package/dist/string-normalization-runtime-CCsvs1ds.js +0 -1
- package/dist/string-sample-BIWt11jp.js +0 -11
- package/dist/strip-inbound-meta-DvHTlpJG.js +0 -155
- package/dist/subagent-orphan-recovery-Do8Az2RD.js +0 -206
- package/dist/subagent-registry-runtime-D5PNyCsh.js +0 -2
- package/dist/subcli-descriptors-Dasenv4J.js +0 -151
- package/dist/subsystem-C9VSlEcV.js +0 -582
- package/dist/supervisor-log.runtime-CZe76kAj.js +0 -8
- package/dist/supervisor-log.runtime.js +0 -1
- package/dist/system-cli-2-HDh_Ev.js +0 -58
- package/dist/system-events-5SDw3lix.js +0 -93
- package/dist/system-events-BuGmSpuG.js +0 -34
- package/dist/system-message-0oem5MWV.js +0 -16
- package/dist/system-run-command-BmlO5dn2.js +0 -301
- package/dist/systemd-B2HBHMpF.js +0 -588
- package/dist/systemd-hints-DkRlAuPR.js +0 -325
- package/dist/systemd-linger-BBPBJSm0.js +0 -68
- package/dist/systemd-linger-DiWO9n2E.js +0 -2
- package/dist/table-CY2XIg3l.js +0 -305
- package/dist/tables-D6qL6k4d.js +0 -832
- package/dist/tailnet-CZMxMuGK.js +0 -76
- package/dist/tailscale-mpS_cTve.js +0 -238
- package/dist/tailscale-status-Dg2Iov5f.js +0 -71
- package/dist/target-errors-ThNFqo8X.js +0 -26
- package/dist/target-ids-O3O6piTN.js +0 -76
- package/dist/target-parsing-Boyj_2v0.js +0 -41
- package/dist/target-registry-BHJcVSo1.js +0 -1269
- package/dist/targets-C7I_wjs2.js +0 -283
- package/dist/targets-CZA632lq.js +0 -39
- package/dist/targets-Dz1dx4G8.js +0 -78
- package/dist/targets-Zd0-pJu7.js +0 -748
- package/dist/targets-krmeAAxz.js +0 -70
- package/dist/task-registry-delivery-runtime-BnkUa6Mp.js +0 -2
- package/dist/task-registry.audit-DbCRt5MR.js +0 -320
- package/dist/task-registry.audit.shared-SH4MOLKM.js +0 -18
- package/dist/task-registry.maintenance-DfZmDWog.js +0 -2
- package/dist/task-registry.summary-SoFiECCc.js +0 -44
- package/dist/tavily-search-provider-BCY1kfQB.js +0 -227
- package/dist/telegram/audit.js +0 -2
- package/dist/telegram/token.js +0 -2
- package/dist/telegram-Cq20PSxw.js +0 -23
- package/dist/telegram-account-vRRwyfuA.js +0 -11
- package/dist/telegram-command-config-BiHhXScJ.js +0 -1
- package/dist/telegram-core-DTJayyAj.js +0 -6
- package/dist/telegram-custom-commands-C-nv8yoB.js +0 -75
- package/dist/temp-download-Ccatr7zI.js +0 -62
- package/dist/temp-path-JU2kkd64.js +0 -2
- package/dist/templating-Bu436Euy.js +0 -24
- package/dist/testing-BrrgubIp.js +0 -690
- package/dist/text-chunking-BTs2yTSd.js +0 -12
- package/dist/text-chunking-ByXwyFNP.js +0 -20
- package/dist/text-format-lEYRGxj5.js +0 -8
- package/dist/text-runtime-D9ApM_8O.js +0 -398
- package/dist/theme-Bb-qluq6.js +0 -2
- package/dist/theme-wBMZmJzz.js +0 -34
- package/dist/thinking-Dga2zdtd.js +0 -68
- package/dist/thinking.shared-D6IkoLJU.js +0 -243
- package/dist/thread-bindings-BMnz7w-V.js +0 -219
- package/dist/thread-bindings-BbQWOcMr.js +0 -352
- package/dist/thread-bindings-Bv0I9sBY.js +0 -534
- package/dist/thread-bindings-C3jMrVvp.js +0 -778
- package/dist/thread-bindings-policy-Br8s4hQ6.js +0 -172
- package/dist/thread-bindings-runtime-CbG63N4N.js +0 -2
- package/dist/thread-bindings-shared-DjSYaoHi.js +0 -95
- package/dist/thread-bindings.discord-api-NFR5qsWt.js +0 -487
- package/dist/thread-ownership-DG810AQi.js +0 -3
- package/dist/threading-1Z_3y_Dp.js +0 -2
- package/dist/threading-Hl8nWez6.js +0 -832
- package/dist/threading-helpers-BpqyeyAU.js +0 -14
- package/dist/threading-tool-context-DxV30qIW.js +0 -157
- package/dist/timeouts-B1NiHSGi.js +0 -74
- package/dist/tlon-C54Qojl0.js +0 -20
- package/dist/tmp-openclaw-dir-B44_vmJv.js +0 -102
- package/dist/token-BlUJQi_X.js +0 -2
- package/dist/token-CDYFJvj8.js +0 -82
- package/dist/token-kCjtGElJ.js +0 -45
- package/dist/tokens-C2f9Klbt.js +0 -66
- package/dist/tool-actions.runtime-aB0DgLk7.js +0 -532
- package/dist/tool-actions.runtime.js +0 -1
- package/dist/tool-display-C7h9IZa_.js +0 -1607
- package/dist/tool-images-BDUvc_pd.js +0 -270
- package/dist/tool-mutation-DIBpIegg.js +0 -140
- package/dist/tool-policy-FUm_F19C.js +0 -515
- package/dist/tool-policy-match-CCFHTsu9.js +0 -49
- package/dist/tool-send-DClM4vsZ.js +0 -16
- package/dist/tools-54j1hYBv.js +0 -123
- package/dist/tools-effective-inventory-C09suj6-.js +0 -148
- package/dist/tools.runtime-VBFxIXC8.js +0 -4
- package/dist/tools.runtime.js +0 -1
- package/dist/transcript-events-Dc7U5QmQ.js +0 -29
- package/dist/transport-ready-Cje3USX4.js +0 -36
- package/dist/tts-CTM9C09A.js +0 -2
- package/dist/tts-Ck_K3tIi.js +0 -84
- package/dist/tts-auto-mode-bD-u2biE.js +0 -14
- package/dist/tts-bTuorllO.js +0 -102
- package/dist/tts-eOLiJF6d.js +0 -29
- package/dist/tts.runtime-ChTwy0yH.js +0 -3
- package/dist/tts.runtime.js +0 -1
- package/dist/tui-CrM-Bz3i.js +0 -3899
- package/dist/tui-cli-aVL5aPGw.js +0 -31
- package/dist/twitch-CFFlkhYG.js +0 -15
- package/dist/typebox-DmerPHaM.js +0 -22
- package/dist/types-BzNSmNk3.js +0 -12
- package/dist/types-DAzqpvqD.js +0 -83
- package/dist/types-DVJVELY7.js +0 -471
- package/dist/types-DqNppUoh.js +0 -15
- package/dist/types.secrets-BpcqHPAv.js +0 -80
- package/dist/types.tools-BTQL6INB.js +0 -22
- package/dist/typing-BnCchGtL.js +0 -8
- package/dist/typing-Bugg5LPP.js +0 -68
- package/dist/typing-J_ktpWeA.js +0 -2
- package/dist/typing-mode-DDYL_0TG.js +0 -75
- package/dist/typing-policy-CaZhrM-F.js +0 -11
- package/dist/typing-start-guard-Cgjgzy5e.js +0 -73
- package/dist/ui-BLDY9-7R.js +0 -212
- package/dist/undici-global-dispatcher-CcNdQ7Dt.js +0 -99
- package/dist/unhandled-rejections-CA_e1R-O.js +0 -2
- package/dist/unhandled-rejections-V7U9keRG.js +0 -241
- package/dist/update-CcALvtl_.js +0 -1253
- package/dist/update-channels-Dn1F57Kf.js +0 -78
- package/dist/update-check-CoDVxy35.js +0 -354
- package/dist/update-cli-BWOYy_Mp.js +0 -1447
- package/dist/update-offset-store-BLZmshZE.js +0 -75
- package/dist/usage-CC7-wLUi.js +0 -39
- package/dist/usage-format-C7nMV1jc.js +0 -513
- package/dist/utils-CN_F_3Qg.js +0 -243
- package/dist/utils-Cgw9Y0-Q.js +0 -2
- package/dist/validation-BNNAUmDO.js +0 -18521
- package/dist/verification-B4ogZ29M.js +0 -130
- package/dist/verification-B99uVIxo.js +0 -2
- package/dist/version-BNzJ37Re.js +0 -79
- package/dist/version-Dw0eJ-1F.js +0 -2
- package/dist/voice-call-Dt6m6oA3.js +0 -4
- package/dist/wait-YXJvtMmp.js +0 -7
- package/dist/warning-filter-GX8LpGKz.js +0 -57
- package/dist/web-fetch-utils-CoVia2ez.js +0 -413
- package/dist/web-media-D9opLz21.js +0 -2
- package/dist/web-media-DHlguFej.js +0 -339
- package/dist/web-search-BcSDWJK9.js +0 -169
- package/dist/web-search-providers-CqY6CVp3.js +0 -21
- package/dist/web-search-providers.runtime-BHjzPQW-.js +0 -113
- package/dist/web-search-providers.runtime.js +0 -1
- package/dist/web-search-providers.shared-CMeQec8y.js +0 -421
- package/dist/web-search-shared-B5mHm7QD.js +0 -87
- package/dist/webhook-ingress-CTl81NUR.js +0 -164
- package/dist/webhook-memory-guards-B6k3g-po.js +0 -129
- package/dist/webhook-path-CklCw5kp.js +0 -22
- package/dist/webhook-request-guards-CxDPmU9e.js +0 -178
- package/dist/webhook-shared-Bw9wLe6L.js +0 -370
- package/dist/webhooks-cli-DPRITERU.js +0 -326
- package/dist/whatsapp-CSzf1Nu0.js +0 -5
- package/dist/whatsapp-D18Otn45.js +0 -30
- package/dist/whatsapp-auth-presence-B5GZUgTA.js +0 -41
- package/dist/whatsapp-core-Be0P_p4R.js +0 -7
- package/dist/whatsapp-heartbeat-a2-OB01n.js +0 -85
- package/dist/whatsapp-shared-ChjLiMDw.js +0 -56
- package/dist/whatsapp-shared-FR_Jw-NH.js +0 -4
- package/dist/whatsapp-surface-Dwrfi_SD.js +0 -26
- package/dist/whatsapp-targets-59A3BDBi.js +0 -13
- package/dist/widearea-dns-CfQt6b3q.js +0 -125
- package/dist/windows-argv-DDAf3waz.js +0 -345
- package/dist/windows-install-roots-XI3CvO9O.js +0 -149
- package/dist/windows-spawn-DKvkg_66.js +0 -154
- package/dist/with-timeout-B2smrGj0.js +0 -214
- package/dist/with-timeout-BmJKiOMd.js +0 -13
- package/dist/workflow-summary-BMvffn8D.js +0 -2
- package/dist/workflow-summary-NvN5lUvK.js +0 -167
- package/dist/workspace-D5P9nuJd.js +0 -479
- package/dist/workspace-D5UiPYKk.js +0 -306
- package/dist/workspace-dirs-CRv8Jwfz.js +0 -13
- package/dist/ws-97FEIc7w.js +0 -11
- package/dist/ws-log-BaAOgG9m.js +0 -281
- package/dist/ws-logging-M92fgmyp.js +0 -10
- package/dist/wsl-ytdRZp54.js +0 -57
- package/dist/x-search-FsMNZ7d0.js +0 -166
- package/dist/x-search-shared-D0tVMJk9.js +0 -124
- package/dist/zalo-CNoa7XH7.js +0 -13
- package/dist/zalo-js-HktBGDbg.js +0 -1156
- package/dist/zalo-setup-BT-xGElf.js +0 -14
- package/dist/zalouser-TwyfhIYz.js +0 -22
- package/dist/zod-1Wegy5nx.js +0 -7
- package/dist/zod-parse-HlGwTZP3.js +0 -14
- package/dist/zod-schema.agent-runtime-DFC7a3eV.js +0 -602
- package/dist/zod-schema.core-C1Ewlj9j.js +0 -520
- package/dist/zod-schema.providers-core-Bmbs-R4l.js +0 -1541
- package/dist/zod-schema.providers-whatsapp-CanJPkvb.js +0 -132
- package/dist/zod-schema.sensitive-DEzKzMxI.js +0 -5
package/dist/bot-BM1bybV7.js
DELETED
|
@@ -1,4268 +0,0 @@
|
|
|
1
|
-
import { i as formatUncaughtError } from "./errors-Bs2h5H8p.js";
|
|
2
|
-
import { i as getChildLogger } from "./logger-MWEZrHUL.js";
|
|
3
|
-
import { t as createNonExitingRuntime } from "./runtime-kS8e4c6-.js";
|
|
4
|
-
import { t as createSubsystemLogger } from "./subsystem-C9VSlEcV.js";
|
|
5
|
-
import { g as resolveDefaultModelForAgent } from "./model-selection-Dx6Ag-ZE.js";
|
|
6
|
-
import { _ as resolveStateDir } from "./paths-GWMNxnBn.js";
|
|
7
|
-
import { _ as normalizeAccountId, d as resolveThreadSessionKeys } from "./session-key-Do__tq1E.js";
|
|
8
|
-
import { a as shouldLogVerbose, r as logVerbose, s as warn, t as danger } from "./globals-CDtV0ht8.js";
|
|
9
|
-
import { a as resolveAgentDir, m as resolveDefaultAgentId } from "./agent-scope-rWWUivuC.js";
|
|
10
|
-
import { c as loadConfig, o as getRuntimeConfigSnapshot, x as writeConfigFile } from "./io-BUxKr33U.js";
|
|
11
|
-
import { i as resolveTelegramCustomCommands, r as normalizeTelegramCommandName, t as TELEGRAM_COMMAND_NAME_PATTERN } from "./telegram-custom-commands-C-nv8yoB.js";
|
|
12
|
-
import { c as resolveSessionStoreEntry, d as updateSessionStore, i as loadSessionStore } from "./store-_OZh8RrM.js";
|
|
13
|
-
import { l as resolveStorePath } from "./paths-xpks599B.js";
|
|
14
|
-
import { a as resolveNativeSkillsEnabled, i as resolveNativeCommandsEnabled, n as isNativeCommandsExplicitlyDisabled } from "./commands-BxWe27p0.js";
|
|
15
|
-
import { m as dispatchPluginInteractiveHandler, v as getPluginCommandSpecs } from "./types-DVJVELY7.js";
|
|
16
|
-
import { t as createDedupeCache } from "./dedupe-DZbQYOSD.js";
|
|
17
|
-
import { f as parsePluginBindingApprovalCustomId, i as buildPluginBindingResolvedText, m as resolvePluginConversationBindingApproval } from "./conversation-binding-C2nuZ3Eg.js";
|
|
18
|
-
import { $ as buildCommandsMessagePaginated } from "./pi-embedded-DEAtCIdT.js";
|
|
19
|
-
import { T as resolveExecApprovalRequestAllowedDecisions } from "./exec-approvals-3UDrE7Q9.js";
|
|
20
|
-
import { r as enqueueSystemEvent } from "./system-events-5SDw3lix.js";
|
|
21
|
-
import { a as buildExecApprovalPendingReplyPayload, u as parseExecApprovalCommandText } from "./exec-approval-reply-CFOEcmIv.js";
|
|
22
|
-
import { p as resolveSendableOutboundReplyParts } from "./reply-payload-CRYI4jIB.js";
|
|
23
|
-
import { c as resolveTextChunkLimit, s as resolveChunkMode } from "./chunk-CW-a7Cfh.js";
|
|
24
|
-
import { r as getAgentScopedMediaLocalRoots } from "./local-roots-DrpNBv4b.js";
|
|
25
|
-
import { _ as resolveChannelConfigWrites } from "./channel-config-helpers-CLFL8FLU.js";
|
|
26
|
-
import { _ as formatReasoningMessage } from "./minimax-vlm-Dh6g-MLh.js";
|
|
27
|
-
import { n as findCodeRegions, r as isInsideCode, t as stripReasoningTagsFromText } from "./reasoning-tags-CAmbBXLr.js";
|
|
28
|
-
import { t as MediaFetchError } from "./fetch-7dbKQPT5.js";
|
|
29
|
-
import { t as loadWebMedia } from "./web-media-DHlguFej.js";
|
|
30
|
-
import { a as modelSupportsVision, n as findModelInCatalog, r as loadModelCatalog } from "./model-catalog-f9zO4b6C.js";
|
|
31
|
-
import { i as resolveAgentRoute } from "./resolve-route-EE8E7OAF.js";
|
|
32
|
-
import { n as sleepWithAbort, t as computeBackoff } from "./backoff-nvVV-tHk.js";
|
|
33
|
-
import { d as listNativeCommandSpecsForConfig, g as resolveCommandArgMenu, m as parseCommandArgs, n as buildCommandTextFromArgs, r as findCommandByNativeName, u as listNativeCommandSpecs } from "./commands-registry-DgMc5_jk.js";
|
|
34
|
-
import { t as applyModelOverrideToSessionEntry } from "./model-overrides-BaecXmMv.js";
|
|
35
|
-
import { c as resolveThreadBindingIdleTimeoutMsForChannel, d as resolveThreadBindingMaxAgeMsForChannel, p as resolveThreadBindingSpawnPolicy } from "./thread-bindings-policy-Br8s4hQ6.js";
|
|
36
|
-
import { n as resolveChannelGroupRequireMention, t as resolveChannelGroupPolicy } from "./group-policy-G9GcSyph.js";
|
|
37
|
-
import "./core-DaMVvavf.js";
|
|
38
|
-
import "./routing-BVt9nMN-.js";
|
|
39
|
-
import { n as isAbortRequestText } from "./abort-primitives-CGyFwJ93.js";
|
|
40
|
-
import { n as resolveInboundDebounceMs, t as createInboundDebouncer } from "./inbound-debounce-CI7l3R36.js";
|
|
41
|
-
import { t as dispatchReplyWithBufferedBlockDispatcher } from "./provider-dispatcher-COxXbow_.js";
|
|
42
|
-
import { t as removeAckReactionAfterReply } from "./ack-reactions-fcKs7CQ_.js";
|
|
43
|
-
import { t as resolveCommandAuthorizedFromAuthorizers } from "./command-gating-NyDk7t84.js";
|
|
44
|
-
import { t as resolveMarkdownTableMode } from "./markdown-tables-CSlyhQVP.js";
|
|
45
|
-
import { a as readChannelAllowFromStore, d as upsertChannelPairingRequest } from "./pairing-store-B171dUVa.js";
|
|
46
|
-
import { t as resolveCommandAuthorization } from "./command-auth-BAkZv3cP.js";
|
|
47
|
-
import { i as resolveStoredModelOverride } from "./model-selection-DXY5nwui.js";
|
|
48
|
-
import { s as clearHistoryEntriesIfEnabled } from "./history-B4mW8GfY.js";
|
|
49
|
-
import "./reply-history-DtTaPEgt.js";
|
|
50
|
-
import "./runtime-env-SHKgcATc.js";
|
|
51
|
-
import { o as resolveExecApprovalCommandDisplay } from "./exec-approval-session-target-BbsAlD1Q.js";
|
|
52
|
-
import "./approval-runtime-DIA8ohXa.js";
|
|
53
|
-
import { r as buildPluginApprovalPendingReplyPayload } from "./approval-renderers-BTKeDNRo.js";
|
|
54
|
-
import { t as createChannelNativeApprovalRuntime } from "./approval-native-runtime-2AVlvrdL.js";
|
|
55
|
-
import { t as createOperatorApprovalsGatewayClient } from "./operator-approvals-client-NQtGN5k_.js";
|
|
56
|
-
import "./config-runtime-ngoccXmP.js";
|
|
57
|
-
import { n as isBtwRequestText } from "./btw-command-CPUGSdlD.js";
|
|
58
|
-
import { n as resolveAutoTopicLabelConfig, t as generateTopicLabel } from "./reply-runtime-DUrpJTzu.js";
|
|
59
|
-
import "./reply-dispatch-runtime-Bk9RDzB9.js";
|
|
60
|
-
import "./reply-chunking-CxFd5izq.js";
|
|
61
|
-
import { t as createChannelReplyPipeline } from "./channel-reply-pipeline-BtBcBCNu.js";
|
|
62
|
-
import "./channel-runtime-F8_51GPp.js";
|
|
63
|
-
import "./infra-runtime-Cl0iZpRS.js";
|
|
64
|
-
import "./runtime-config-snapshot-DqWNFIej.js";
|
|
65
|
-
import "./media-runtime-8QR_uTs0.js";
|
|
66
|
-
import "./conversation-runtime-bArk0IjJ.js";
|
|
67
|
-
import "./text-runtime-D9ApM_8O.js";
|
|
68
|
-
import "./agent-runtime-Cz19IsmJ.js";
|
|
69
|
-
import "./plugin-runtime-Dd1YN95W.js";
|
|
70
|
-
import "./gateway-runtime-C7EhkU_c.js";
|
|
71
|
-
import { n as formatModelsAvailableHeader, t as buildModelsProviderData } from "./commands-models-B4EJh5Fy.js";
|
|
72
|
-
import "./markdown-table-runtime-Dx12DQTq.js";
|
|
73
|
-
import { r as logTypingFailure, t as logAckFailure } from "./logging-ColPHIDT.js";
|
|
74
|
-
import { t as resolveNativeCommandSessionTargets } from "./native-command-session-targets-DfUCBY63.js";
|
|
75
|
-
import { t as listSkillCommandsForAgents } from "./skill-commands-CH4lfyW8.js";
|
|
76
|
-
import { t as buildCommandsPaginationKeyboard } from "./commands-info-COwAtIWb.js";
|
|
77
|
-
import "./command-auth-tqFmaIaJ.js";
|
|
78
|
-
import "./command-auth-native-Bsp5Doyd.js";
|
|
79
|
-
import "./web-media-D9opLz21.js";
|
|
80
|
-
import "./error-runtime-D-gKufd_.js";
|
|
81
|
-
import { n as shouldDebounceTextInbound } from "./channel-inbound-CXD3aSAK.js";
|
|
82
|
-
import { i as createFinalizableDraftLifecycle } from "./channel-lifecycle-BnjeZxB6.js";
|
|
83
|
-
import "./state-paths-LoYjHd5L.js";
|
|
84
|
-
import "./models-provider-runtime-DfIZ0cvV.js";
|
|
85
|
-
import "./skill-commands-runtime-zpWkVBay.js";
|
|
86
|
-
import { s as resolveTelegramAccount } from "./accounts-x23pAGjm.js";
|
|
87
|
-
import { r as resolveTelegramTransport } from "./fetch-BjiGl865.js";
|
|
88
|
-
import { a as isTelegramExecApprovalHandlerConfigured, f as shouldSuppressLocalTelegramExecApprovalPrompt, h as resolveTelegramInlineButtonsScope, l as shouldEnableTelegramExecApprovalButtons, n as isTelegramExecApprovalApprover, r as isTelegramExecApprovalAuthorizedSender, u as shouldHandleTelegramExecApprovalRequest } from "./exec-approvals-CW5axvaY.js";
|
|
89
|
-
import { n as telegramNativeApprovalAdapter } from "./approval-native-CI9-iVJa.js";
|
|
90
|
-
import { C as resolveTelegramThreadSpec, E as buildSenderName, L as isSenderAllowed, P as normalizeTelegramReplyToMessageId, S as resolveTelegramStreamMode, b as resolveTelegramGroupAllowFromContext, d as buildTelegramParentPeer, f as buildTelegramRoutingTarget, g as extractTelegramForumFlag, i as renderTelegramHtmlText, k as getTelegramTextParts, l as buildTelegramGroupFrom, p as buildTelegramThreadParams, s as withTelegramApiErrorLogging, u as buildTelegramGroupPeerId, v as resolveTelegramForumFlag, w as withResolvedTelegramForumFlag, y as resolveTelegramForumThreadId, z as normalizeDmAllowFromWithStore } from "./format-D38w0aKT.js";
|
|
91
|
-
import { t as resolveTelegramInlineButtons } from "./button-types-B3_mzf8P.js";
|
|
92
|
-
import { C as wasSentByBot, E as isTelegramClientRejection, O as tagTelegramNetworkError, S as recordSentMessage, T as isSafeToRetrySendError, d as editMessageReplyMarkupTelegram, f as editMessageTelegram, g as sendMessageTelegram, n as describeStickerImage, s as buildInlineKeyboard, t as cacheSticker, w as isRecoverableTelegramNetworkError, y as sendTypingTelegram } from "./sticker-cache-C_FrWgaA.js";
|
|
93
|
-
import { t as createTelegramThreadBindingManager } from "./thread-bindings-Bv0I9sBY.js";
|
|
94
|
-
import { a as calculateTotalPages, c as resolveModelSelection, i as buildProviderKeyboard, o as getModelsPageSize, r as buildModelsKeyboard, s as parseModelCallbackData } from "./model-buttons-zQ-cRhqo.js";
|
|
95
|
-
import { n as evaluateTelegramGroupPolicyAccess, t as evaluateTelegramGroupBaseAccess } from "./group-access-owHLoCWX.js";
|
|
96
|
-
import { a as resolveTelegramGroupPromptSettings, i as resolveTelegramConversationRoute, n as enforceTelegramDmAccess, r as resolveTelegramConversationBaseSessionKey, t as buildTelegramMessageContext } from "./bot-message-context-DKGx6N8p.js";
|
|
97
|
-
import { n as deliverReplies, r as emitInternalMessageSentHook, t as resolveMedia } from "./delivery-CL_3vFSl.js";
|
|
98
|
-
import path from "node:path";
|
|
99
|
-
import os from "node:os";
|
|
100
|
-
import fs from "node:fs/promises";
|
|
101
|
-
import { createHash } from "node:crypto";
|
|
102
|
-
import { Bot as Bot$1 } from "grammy";
|
|
103
|
-
import { sequentialize } from "@grammyjs/runner";
|
|
104
|
-
import { apiThrottler } from "@grammyjs/transformer-throttler";
|
|
105
|
-
//#region extensions/telegram/src/exec-approvals-handler.ts
|
|
106
|
-
const log = createSubsystemLogger("telegram/exec-approvals");
|
|
107
|
-
function isHandlerConfigured(params) {
|
|
108
|
-
return isTelegramExecApprovalHandlerConfigured(params);
|
|
109
|
-
}
|
|
110
|
-
var TelegramExecApprovalHandler = class {
|
|
111
|
-
constructor(opts, deps = {}) {
|
|
112
|
-
this.opts = opts;
|
|
113
|
-
this.nowMs = deps.nowMs ?? Date.now;
|
|
114
|
-
this.sendTyping = deps.sendTyping ?? sendTypingTelegram;
|
|
115
|
-
this.sendMessage = deps.sendMessage ?? sendMessageTelegram;
|
|
116
|
-
this.editReplyMarkup = deps.editReplyMarkup ?? editMessageReplyMarkupTelegram;
|
|
117
|
-
this.runtime = createChannelNativeApprovalRuntime({
|
|
118
|
-
label: "telegram/exec-approvals",
|
|
119
|
-
clientDisplayName: `Telegram Exec Approvals (${this.opts.accountId})`,
|
|
120
|
-
cfg: this.opts.cfg,
|
|
121
|
-
accountId: this.opts.accountId,
|
|
122
|
-
gatewayUrl: this.opts.gatewayUrl,
|
|
123
|
-
eventKinds: ["exec", "plugin"],
|
|
124
|
-
nowMs: this.nowMs,
|
|
125
|
-
nativeAdapter: telegramNativeApprovalAdapter.native,
|
|
126
|
-
isConfigured: () => isHandlerConfigured({
|
|
127
|
-
cfg: this.opts.cfg,
|
|
128
|
-
accountId: this.opts.accountId
|
|
129
|
-
}),
|
|
130
|
-
shouldHandle: (request) => shouldHandleTelegramExecApprovalRequest({
|
|
131
|
-
cfg: this.opts.cfg,
|
|
132
|
-
accountId: this.opts.accountId,
|
|
133
|
-
request
|
|
134
|
-
}),
|
|
135
|
-
buildPendingContent: ({ request, approvalKind, nowMs }) => {
|
|
136
|
-
const payload = approvalKind === "plugin" ? buildPluginApprovalPendingReplyPayload({
|
|
137
|
-
request,
|
|
138
|
-
nowMs
|
|
139
|
-
}) : buildExecApprovalPendingReplyPayload({
|
|
140
|
-
approvalId: request.id,
|
|
141
|
-
approvalSlug: request.id.slice(0, 8),
|
|
142
|
-
approvalCommandId: request.id,
|
|
143
|
-
command: resolveExecApprovalCommandDisplay(request.request).commandText,
|
|
144
|
-
cwd: request.request.cwd ?? void 0,
|
|
145
|
-
host: request.request.host === "node" ? "node" : "gateway",
|
|
146
|
-
nodeId: request.request.nodeId ?? void 0,
|
|
147
|
-
allowedDecisions: resolveExecApprovalRequestAllowedDecisions(request.request),
|
|
148
|
-
expiresAtMs: request.expiresAtMs,
|
|
149
|
-
nowMs
|
|
150
|
-
});
|
|
151
|
-
return {
|
|
152
|
-
text: payload.text ?? "",
|
|
153
|
-
buttons: resolveTelegramInlineButtons({ interactive: payload.interactive })
|
|
154
|
-
};
|
|
155
|
-
},
|
|
156
|
-
prepareTarget: ({ plannedTarget }) => ({
|
|
157
|
-
dedupeKey: `${plannedTarget.target.to}:${plannedTarget.target.threadId == null ? "" : String(plannedTarget.target.threadId)}`,
|
|
158
|
-
target: {
|
|
159
|
-
chatId: plannedTarget.target.to,
|
|
160
|
-
messageThreadId: typeof plannedTarget.target.threadId === "number" ? plannedTarget.target.threadId : void 0
|
|
161
|
-
}
|
|
162
|
-
}),
|
|
163
|
-
deliverTarget: async ({ preparedTarget, pendingContent }) => {
|
|
164
|
-
await this.sendTyping(preparedTarget.chatId, {
|
|
165
|
-
cfg: this.opts.cfg,
|
|
166
|
-
token: this.opts.token,
|
|
167
|
-
accountId: this.opts.accountId,
|
|
168
|
-
...preparedTarget.messageThreadId != null ? { messageThreadId: preparedTarget.messageThreadId } : {}
|
|
169
|
-
}).catch(() => {});
|
|
170
|
-
const result = await this.sendMessage(preparedTarget.chatId, pendingContent.text, {
|
|
171
|
-
cfg: this.opts.cfg,
|
|
172
|
-
token: this.opts.token,
|
|
173
|
-
accountId: this.opts.accountId,
|
|
174
|
-
buttons: pendingContent.buttons,
|
|
175
|
-
...preparedTarget.messageThreadId != null ? { messageThreadId: preparedTarget.messageThreadId } : {}
|
|
176
|
-
});
|
|
177
|
-
return {
|
|
178
|
-
chatId: result.chatId,
|
|
179
|
-
messageId: result.messageId
|
|
180
|
-
};
|
|
181
|
-
},
|
|
182
|
-
onDeliveryError: ({ error, request }) => {
|
|
183
|
-
log.error(`telegram exec approvals: failed to send request ${request.id}: ${String(error)}`);
|
|
184
|
-
},
|
|
185
|
-
finalizeResolved: async ({ resolved, entries }) => {
|
|
186
|
-
await this.finalizeResolved(resolved, entries);
|
|
187
|
-
},
|
|
188
|
-
finalizeExpired: async ({ entries }) => {
|
|
189
|
-
await this.clearPending(entries);
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
shouldHandle(request) {
|
|
194
|
-
return shouldHandleTelegramExecApprovalRequest({
|
|
195
|
-
cfg: this.opts.cfg,
|
|
196
|
-
accountId: this.opts.accountId,
|
|
197
|
-
request
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
async start() {
|
|
201
|
-
await this.runtime.start();
|
|
202
|
-
}
|
|
203
|
-
async stop() {
|
|
204
|
-
await this.runtime.stop();
|
|
205
|
-
}
|
|
206
|
-
async handleRequested(request) {
|
|
207
|
-
await this.runtime.handleRequested(request);
|
|
208
|
-
}
|
|
209
|
-
async handleResolved(resolved) {
|
|
210
|
-
await this.runtime.handleResolved(resolved);
|
|
211
|
-
}
|
|
212
|
-
async finalizeResolved(_resolved, messages) {
|
|
213
|
-
await this.clearPending(messages);
|
|
214
|
-
}
|
|
215
|
-
async clearPending(messages) {
|
|
216
|
-
await Promise.allSettled(messages.map(async (message) => {
|
|
217
|
-
await this.editReplyMarkup(message.chatId, message.messageId, [], {
|
|
218
|
-
cfg: this.opts.cfg,
|
|
219
|
-
token: this.opts.token,
|
|
220
|
-
accountId: this.opts.accountId
|
|
221
|
-
});
|
|
222
|
-
}));
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
const TELEGRAM_COMMAND_RETRY_RATIO = .8;
|
|
226
|
-
function readErrorTextField(value, key) {
|
|
227
|
-
if (!value || typeof value !== "object" || !(key in value)) return;
|
|
228
|
-
const text = value[key];
|
|
229
|
-
return typeof text === "string" ? text : void 0;
|
|
230
|
-
}
|
|
231
|
-
function isBotCommandsTooMuchError(err) {
|
|
232
|
-
if (!err) return false;
|
|
233
|
-
const pattern = /\bBOT_COMMANDS_TOO_MUCH\b/i;
|
|
234
|
-
if (typeof err === "string") return pattern.test(err);
|
|
235
|
-
if (err instanceof Error) {
|
|
236
|
-
if (pattern.test(err.message)) return true;
|
|
237
|
-
}
|
|
238
|
-
const description = readErrorTextField(err, "description");
|
|
239
|
-
if (description && pattern.test(description)) return true;
|
|
240
|
-
const message = readErrorTextField(err, "message");
|
|
241
|
-
if (message && pattern.test(message)) return true;
|
|
242
|
-
return false;
|
|
243
|
-
}
|
|
244
|
-
function formatTelegramCommandRetrySuccessLog(params) {
|
|
245
|
-
const omittedCount = Math.max(0, params.initialCount - params.acceptedCount);
|
|
246
|
-
return `Telegram accepted ${params.acceptedCount} commands after BOT_COMMANDS_TOO_MUCH (started with ${params.initialCount}; omitted ${omittedCount}). Reduce plugin/skill/custom commands to expose more menu entries.`;
|
|
247
|
-
}
|
|
248
|
-
function buildPluginTelegramMenuCommands(params) {
|
|
249
|
-
const { specs, existingCommands } = params;
|
|
250
|
-
const commands = [];
|
|
251
|
-
const issues = [];
|
|
252
|
-
const pluginCommandNames = /* @__PURE__ */ new Set();
|
|
253
|
-
for (const spec of specs) {
|
|
254
|
-
const rawName = typeof spec.name === "string" ? spec.name : "";
|
|
255
|
-
const normalized = normalizeTelegramCommandName(rawName);
|
|
256
|
-
if (!normalized || !TELEGRAM_COMMAND_NAME_PATTERN.test(normalized)) {
|
|
257
|
-
const invalidName = rawName.trim() ? rawName : "<unknown>";
|
|
258
|
-
issues.push(`Plugin command "/${invalidName}" is invalid for Telegram (use a-z, 0-9, underscore; max 32 chars).`);
|
|
259
|
-
continue;
|
|
260
|
-
}
|
|
261
|
-
const description = typeof spec.description === "string" ? spec.description.trim() : "";
|
|
262
|
-
if (!description) {
|
|
263
|
-
issues.push(`Plugin command "/${normalized}" is missing a description.`);
|
|
264
|
-
continue;
|
|
265
|
-
}
|
|
266
|
-
if (existingCommands.has(normalized)) {
|
|
267
|
-
if (pluginCommandNames.has(normalized)) issues.push(`Plugin command "/${normalized}" is duplicated.`);
|
|
268
|
-
else issues.push(`Plugin command "/${normalized}" conflicts with an existing Telegram command.`);
|
|
269
|
-
continue;
|
|
270
|
-
}
|
|
271
|
-
pluginCommandNames.add(normalized);
|
|
272
|
-
existingCommands.add(normalized);
|
|
273
|
-
commands.push({
|
|
274
|
-
command: normalized,
|
|
275
|
-
description
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
return {
|
|
279
|
-
commands,
|
|
280
|
-
issues
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
function buildCappedTelegramMenuCommands(params) {
|
|
284
|
-
const { allCommands } = params;
|
|
285
|
-
const maxCommands = params.maxCommands ?? 100;
|
|
286
|
-
const totalCommands = allCommands.length;
|
|
287
|
-
const overflowCount = Math.max(0, totalCommands - maxCommands);
|
|
288
|
-
return {
|
|
289
|
-
commandsToRegister: allCommands.slice(0, maxCommands),
|
|
290
|
-
totalCommands,
|
|
291
|
-
maxCommands,
|
|
292
|
-
overflowCount
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
/** Compute a stable hash of the command list for change detection. */
|
|
296
|
-
function hashCommandList(commands) {
|
|
297
|
-
const sorted = [...commands].toSorted((a, b) => a.command.localeCompare(b.command));
|
|
298
|
-
return createHash("sha256").update(JSON.stringify(sorted)).digest("hex").slice(0, 16);
|
|
299
|
-
}
|
|
300
|
-
function hashBotIdentity(botIdentity) {
|
|
301
|
-
const normalized = botIdentity?.trim();
|
|
302
|
-
if (!normalized) return "no-bot";
|
|
303
|
-
return createHash("sha256").update(normalized).digest("hex").slice(0, 16);
|
|
304
|
-
}
|
|
305
|
-
function resolveCommandHashPath(accountId, botIdentity) {
|
|
306
|
-
const stateDir = resolveStateDir(process.env, os.homedir);
|
|
307
|
-
const normalizedAccount = accountId?.trim().replace(/[^a-z0-9._-]+/gi, "_") || "default";
|
|
308
|
-
const botHash = hashBotIdentity(botIdentity);
|
|
309
|
-
return path.join(stateDir, "telegram", `command-hash-${normalizedAccount}-${botHash}.txt`);
|
|
310
|
-
}
|
|
311
|
-
async function readCachedCommandHash(accountId, botIdentity) {
|
|
312
|
-
try {
|
|
313
|
-
return (await fs.readFile(resolveCommandHashPath(accountId, botIdentity), "utf-8")).trim();
|
|
314
|
-
} catch {
|
|
315
|
-
return null;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
async function writeCachedCommandHash(accountId, botIdentity, hash) {
|
|
319
|
-
const filePath = resolveCommandHashPath(accountId, botIdentity);
|
|
320
|
-
try {
|
|
321
|
-
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
322
|
-
await fs.writeFile(filePath, hash, "utf-8");
|
|
323
|
-
} catch {}
|
|
324
|
-
}
|
|
325
|
-
function syncTelegramMenuCommands(params) {
|
|
326
|
-
const { bot, runtime, commandsToRegister, accountId, botIdentity } = params;
|
|
327
|
-
const sync = async () => {
|
|
328
|
-
const currentHash = hashCommandList(commandsToRegister);
|
|
329
|
-
if (await readCachedCommandHash(accountId, botIdentity) === currentHash) {
|
|
330
|
-
logVerbose("telegram: command menu unchanged; skipping sync");
|
|
331
|
-
return;
|
|
332
|
-
}
|
|
333
|
-
let deleteSucceeded = true;
|
|
334
|
-
if (typeof bot.api.deleteMyCommands === "function") deleteSucceeded = await withTelegramApiErrorLogging({
|
|
335
|
-
operation: "deleteMyCommands",
|
|
336
|
-
runtime,
|
|
337
|
-
fn: () => bot.api.deleteMyCommands()
|
|
338
|
-
}).then(() => true).catch(() => false);
|
|
339
|
-
if (commandsToRegister.length === 0) {
|
|
340
|
-
if (!deleteSucceeded) {
|
|
341
|
-
runtime.log?.("telegram: deleteMyCommands failed; skipping empty-menu hash cache write");
|
|
342
|
-
return;
|
|
343
|
-
}
|
|
344
|
-
await writeCachedCommandHash(accountId, botIdentity, currentHash);
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
let retryCommands = commandsToRegister;
|
|
348
|
-
const initialCommandCount = commandsToRegister.length;
|
|
349
|
-
while (retryCommands.length > 0) try {
|
|
350
|
-
await withTelegramApiErrorLogging({
|
|
351
|
-
operation: "setMyCommands",
|
|
352
|
-
runtime,
|
|
353
|
-
shouldLog: (err) => !isBotCommandsTooMuchError(err),
|
|
354
|
-
fn: () => bot.api.setMyCommands(retryCommands)
|
|
355
|
-
});
|
|
356
|
-
if (retryCommands.length < initialCommandCount) runtime.log?.(formatTelegramCommandRetrySuccessLog({
|
|
357
|
-
initialCount: initialCommandCount,
|
|
358
|
-
acceptedCount: retryCommands.length
|
|
359
|
-
}));
|
|
360
|
-
await writeCachedCommandHash(accountId, botIdentity, currentHash);
|
|
361
|
-
return;
|
|
362
|
-
} catch (err) {
|
|
363
|
-
if (!isBotCommandsTooMuchError(err)) throw err;
|
|
364
|
-
const nextCount = Math.floor(retryCommands.length * TELEGRAM_COMMAND_RETRY_RATIO);
|
|
365
|
-
const reducedCount = nextCount < retryCommands.length ? nextCount : retryCommands.length - 1;
|
|
366
|
-
if (reducedCount <= 0) {
|
|
367
|
-
runtime.error?.("Telegram rejected native command registration (BOT_COMMANDS_TOO_MUCH); leaving menu empty. Reduce commands or disable channels.telegram.commands.native.");
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
runtime.log?.(`Telegram rejected ${retryCommands.length} commands (BOT_COMMANDS_TOO_MUCH); retrying with ${reducedCount}.`);
|
|
371
|
-
retryCommands = retryCommands.slice(0, reducedCount);
|
|
372
|
-
}
|
|
373
|
-
};
|
|
374
|
-
sync().catch((err) => {
|
|
375
|
-
runtime.error?.(`Telegram command sync failed: ${String(err)}`);
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
//#endregion
|
|
379
|
-
//#region extensions/telegram/src/draft-stream.ts
|
|
380
|
-
const TELEGRAM_STREAM_MAX_CHARS = 4096;
|
|
381
|
-
const DEFAULT_THROTTLE_MS = 1e3;
|
|
382
|
-
const TELEGRAM_DRAFT_ID_MAX = 2147483647;
|
|
383
|
-
const THREAD_NOT_FOUND_RE = /400:\s*Bad Request:\s*message thread not found/i;
|
|
384
|
-
const DRAFT_METHOD_UNAVAILABLE_RE = /(unknown method|method .*not (found|available|supported)|unsupported)/i;
|
|
385
|
-
const DRAFT_CHAT_UNSUPPORTED_RE = /(can't be used|can be used only)/i;
|
|
386
|
-
function hasNumericMessageThreadId(params) {
|
|
387
|
-
return typeof params === "object" && params !== null && typeof params.message_thread_id === "number";
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* Keep draft-id allocation shared across bundled chunks so concurrent preview
|
|
391
|
-
* lanes do not accidentally reuse draft ids when code-split entries coexist.
|
|
392
|
-
*/
|
|
393
|
-
const TELEGRAM_DRAFT_STREAM_STATE_KEY = Symbol.for("openclaw.telegramDraftStreamState");
|
|
394
|
-
let draftStreamState;
|
|
395
|
-
function getDraftStreamState() {
|
|
396
|
-
if (!draftStreamState) {
|
|
397
|
-
const globalStore = globalThis;
|
|
398
|
-
draftStreamState = globalStore[TELEGRAM_DRAFT_STREAM_STATE_KEY] ?? { nextDraftId: 0 };
|
|
399
|
-
globalStore[TELEGRAM_DRAFT_STREAM_STATE_KEY] = draftStreamState;
|
|
400
|
-
}
|
|
401
|
-
return draftStreamState;
|
|
402
|
-
}
|
|
403
|
-
function allocateTelegramDraftId() {
|
|
404
|
-
const state = getDraftStreamState();
|
|
405
|
-
state.nextDraftId = state.nextDraftId >= TELEGRAM_DRAFT_ID_MAX ? 1 : state.nextDraftId + 1;
|
|
406
|
-
return state.nextDraftId;
|
|
407
|
-
}
|
|
408
|
-
function resolveSendMessageDraftApi(api) {
|
|
409
|
-
const sendMessageDraft = api.sendMessageDraft;
|
|
410
|
-
if (typeof sendMessageDraft !== "function") return;
|
|
411
|
-
return sendMessageDraft.bind(api);
|
|
412
|
-
}
|
|
413
|
-
function shouldFallbackFromDraftTransport(err) {
|
|
414
|
-
const text = typeof err === "string" ? err : err instanceof Error ? err.message : typeof err === "object" && err && "description" in err ? typeof err.description === "string" ? err.description : "" : "";
|
|
415
|
-
if (!/sendMessageDraft/i.test(text)) return false;
|
|
416
|
-
return DRAFT_METHOD_UNAVAILABLE_RE.test(text) || DRAFT_CHAT_UNSUPPORTED_RE.test(text);
|
|
417
|
-
}
|
|
418
|
-
function createTelegramDraftStream(params) {
|
|
419
|
-
const maxChars = Math.min(params.maxChars ?? TELEGRAM_STREAM_MAX_CHARS, TELEGRAM_STREAM_MAX_CHARS);
|
|
420
|
-
const throttleMs = Math.max(250, params.throttleMs ?? DEFAULT_THROTTLE_MS);
|
|
421
|
-
const minInitialChars = params.minInitialChars;
|
|
422
|
-
const chatId = params.chatId;
|
|
423
|
-
const requestedPreviewTransport = params.previewTransport ?? "auto";
|
|
424
|
-
const prefersDraftTransport = requestedPreviewTransport === "draft" ? true : requestedPreviewTransport === "message" ? false : params.thread?.scope === "dm";
|
|
425
|
-
const threadParams = buildTelegramThreadParams(params.thread);
|
|
426
|
-
const replyToMessageId = normalizeTelegramReplyToMessageId(params.replyToMessageId);
|
|
427
|
-
const replyParams = replyToMessageId != null ? {
|
|
428
|
-
...threadParams,
|
|
429
|
-
reply_to_message_id: replyToMessageId,
|
|
430
|
-
allow_sending_without_reply: true
|
|
431
|
-
} : threadParams;
|
|
432
|
-
const resolvedDraftApi = prefersDraftTransport ? resolveSendMessageDraftApi(params.api) : void 0;
|
|
433
|
-
const usesDraftTransport = Boolean(prefersDraftTransport && resolvedDraftApi);
|
|
434
|
-
if (prefersDraftTransport && !usesDraftTransport) params.warn?.("telegram stream preview: sendMessageDraft unavailable; falling back to sendMessage/editMessageText");
|
|
435
|
-
const streamState = {
|
|
436
|
-
stopped: false,
|
|
437
|
-
final: false
|
|
438
|
-
};
|
|
439
|
-
let messageSendAttempted = false;
|
|
440
|
-
let streamMessageId;
|
|
441
|
-
let streamDraftId = usesDraftTransport ? allocateTelegramDraftId() : void 0;
|
|
442
|
-
let previewTransport = usesDraftTransport ? "draft" : "message";
|
|
443
|
-
let lastSentText = "";
|
|
444
|
-
let lastDeliveredText = "";
|
|
445
|
-
let lastSentParseMode;
|
|
446
|
-
let previewRevision = 0;
|
|
447
|
-
let generation = 0;
|
|
448
|
-
const sendRenderedMessageWithThreadFallback = async (sendArgs) => {
|
|
449
|
-
const sendParams = sendArgs.renderedParseMode ? {
|
|
450
|
-
...replyParams,
|
|
451
|
-
parse_mode: sendArgs.renderedParseMode
|
|
452
|
-
} : replyParams;
|
|
453
|
-
const usedThreadParams = hasNumericMessageThreadId(sendParams);
|
|
454
|
-
try {
|
|
455
|
-
return {
|
|
456
|
-
sent: await params.api.sendMessage(chatId, sendArgs.renderedText, sendParams),
|
|
457
|
-
usedThreadParams
|
|
458
|
-
};
|
|
459
|
-
} catch (err) {
|
|
460
|
-
if (!usedThreadParams || !THREAD_NOT_FOUND_RE.test(String(err))) throw err;
|
|
461
|
-
const threadlessParams = { ...sendParams ?? {} };
|
|
462
|
-
delete threadlessParams.message_thread_id;
|
|
463
|
-
params.warn?.(sendArgs.fallbackWarnMessage);
|
|
464
|
-
return {
|
|
465
|
-
sent: await params.api.sendMessage(chatId, sendArgs.renderedText, Object.keys(threadlessParams).length > 0 ? threadlessParams : void 0),
|
|
466
|
-
usedThreadParams: false
|
|
467
|
-
};
|
|
468
|
-
}
|
|
469
|
-
};
|
|
470
|
-
const sendMessageTransportPreview = async ({ renderedText, renderedParseMode, sendGeneration }) => {
|
|
471
|
-
if (typeof streamMessageId === "number") {
|
|
472
|
-
if (renderedParseMode) await params.api.editMessageText(chatId, streamMessageId, renderedText, { parse_mode: renderedParseMode });
|
|
473
|
-
else await params.api.editMessageText(chatId, streamMessageId, renderedText);
|
|
474
|
-
return true;
|
|
475
|
-
}
|
|
476
|
-
messageSendAttempted = true;
|
|
477
|
-
let sent;
|
|
478
|
-
try {
|
|
479
|
-
({sent} = await sendRenderedMessageWithThreadFallback({
|
|
480
|
-
renderedText,
|
|
481
|
-
renderedParseMode,
|
|
482
|
-
fallbackWarnMessage: "telegram stream preview send failed with message_thread_id, retrying without thread"
|
|
483
|
-
}));
|
|
484
|
-
} catch (err) {
|
|
485
|
-
if (isSafeToRetrySendError(err) || isTelegramClientRejection(err)) messageSendAttempted = false;
|
|
486
|
-
throw err;
|
|
487
|
-
}
|
|
488
|
-
const sentMessageId = sent?.message_id;
|
|
489
|
-
if (typeof sentMessageId !== "number" || !Number.isFinite(sentMessageId)) {
|
|
490
|
-
streamState.stopped = true;
|
|
491
|
-
params.warn?.("telegram stream preview stopped (missing message id from sendMessage)");
|
|
492
|
-
return false;
|
|
493
|
-
}
|
|
494
|
-
const normalizedMessageId = Math.trunc(sentMessageId);
|
|
495
|
-
if (sendGeneration !== generation) {
|
|
496
|
-
params.onSupersededPreview?.({
|
|
497
|
-
messageId: normalizedMessageId,
|
|
498
|
-
textSnapshot: renderedText,
|
|
499
|
-
parseMode: renderedParseMode
|
|
500
|
-
});
|
|
501
|
-
return true;
|
|
502
|
-
}
|
|
503
|
-
streamMessageId = normalizedMessageId;
|
|
504
|
-
return true;
|
|
505
|
-
};
|
|
506
|
-
const sendDraftTransportPreview = async ({ renderedText, renderedParseMode }) => {
|
|
507
|
-
const draftId = streamDraftId ?? allocateTelegramDraftId();
|
|
508
|
-
streamDraftId = draftId;
|
|
509
|
-
const draftParams = {
|
|
510
|
-
...threadParams?.message_thread_id != null ? { message_thread_id: threadParams.message_thread_id } : {},
|
|
511
|
-
...renderedParseMode ? { parse_mode: renderedParseMode } : {}
|
|
512
|
-
};
|
|
513
|
-
await resolvedDraftApi(chatId, draftId, renderedText, Object.keys(draftParams).length > 0 ? draftParams : void 0);
|
|
514
|
-
return true;
|
|
515
|
-
};
|
|
516
|
-
const sendOrEditStreamMessage = async (text) => {
|
|
517
|
-
if (streamState.stopped && !streamState.final) return false;
|
|
518
|
-
const trimmed = text.trimEnd();
|
|
519
|
-
if (!trimmed) return false;
|
|
520
|
-
const rendered = params.renderText?.(trimmed) ?? { text: trimmed };
|
|
521
|
-
const renderedText = rendered.text.trimEnd();
|
|
522
|
-
const renderedParseMode = rendered.parseMode;
|
|
523
|
-
if (!renderedText) return false;
|
|
524
|
-
if (renderedText.length > maxChars) {
|
|
525
|
-
streamState.stopped = true;
|
|
526
|
-
params.warn?.(`telegram stream preview stopped (text length ${renderedText.length} > ${maxChars})`);
|
|
527
|
-
return false;
|
|
528
|
-
}
|
|
529
|
-
if (renderedText === lastSentText && renderedParseMode === lastSentParseMode) return true;
|
|
530
|
-
const sendGeneration = generation;
|
|
531
|
-
if (typeof streamMessageId !== "number" && minInitialChars != null && !streamState.final) {
|
|
532
|
-
if (renderedText.length < minInitialChars) return false;
|
|
533
|
-
}
|
|
534
|
-
lastSentText = renderedText;
|
|
535
|
-
lastSentParseMode = renderedParseMode;
|
|
536
|
-
try {
|
|
537
|
-
let sent = false;
|
|
538
|
-
if (previewTransport === "draft") try {
|
|
539
|
-
sent = await sendDraftTransportPreview({
|
|
540
|
-
renderedText,
|
|
541
|
-
renderedParseMode,
|
|
542
|
-
sendGeneration
|
|
543
|
-
});
|
|
544
|
-
} catch (err) {
|
|
545
|
-
if (!shouldFallbackFromDraftTransport(err)) throw err;
|
|
546
|
-
previewTransport = "message";
|
|
547
|
-
streamDraftId = void 0;
|
|
548
|
-
params.warn?.("telegram stream preview: sendMessageDraft rejected by API; falling back to sendMessage/editMessageText");
|
|
549
|
-
sent = await sendMessageTransportPreview({
|
|
550
|
-
renderedText,
|
|
551
|
-
renderedParseMode,
|
|
552
|
-
sendGeneration
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
else sent = await sendMessageTransportPreview({
|
|
556
|
-
renderedText,
|
|
557
|
-
renderedParseMode,
|
|
558
|
-
sendGeneration
|
|
559
|
-
});
|
|
560
|
-
if (sent) {
|
|
561
|
-
previewRevision += 1;
|
|
562
|
-
lastDeliveredText = trimmed;
|
|
563
|
-
}
|
|
564
|
-
return sent;
|
|
565
|
-
} catch (err) {
|
|
566
|
-
streamState.stopped = true;
|
|
567
|
-
params.warn?.(`telegram stream preview failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
568
|
-
return false;
|
|
569
|
-
}
|
|
570
|
-
};
|
|
571
|
-
const { loop, update, stop, clear } = createFinalizableDraftLifecycle({
|
|
572
|
-
throttleMs,
|
|
573
|
-
state: streamState,
|
|
574
|
-
sendOrEditStreamMessage,
|
|
575
|
-
readMessageId: () => streamMessageId,
|
|
576
|
-
clearMessageId: () => {
|
|
577
|
-
streamMessageId = void 0;
|
|
578
|
-
},
|
|
579
|
-
isValidMessageId: (value) => typeof value === "number" && Number.isFinite(value),
|
|
580
|
-
deleteMessage: async (messageId) => {
|
|
581
|
-
await params.api.deleteMessage(chatId, messageId);
|
|
582
|
-
},
|
|
583
|
-
onDeleteSuccess: (messageId) => {
|
|
584
|
-
params.log?.(`telegram stream preview deleted (chat=${chatId}, message=${messageId})`);
|
|
585
|
-
},
|
|
586
|
-
warn: params.warn,
|
|
587
|
-
warnPrefix: "telegram stream preview cleanup failed"
|
|
588
|
-
});
|
|
589
|
-
const forceNewMessage = () => {
|
|
590
|
-
streamState.final = false;
|
|
591
|
-
generation += 1;
|
|
592
|
-
messageSendAttempted = false;
|
|
593
|
-
streamMessageId = void 0;
|
|
594
|
-
if (previewTransport === "draft") streamDraftId = allocateTelegramDraftId();
|
|
595
|
-
lastSentText = "";
|
|
596
|
-
lastSentParseMode = void 0;
|
|
597
|
-
loop.resetPending();
|
|
598
|
-
loop.resetThrottleWindow();
|
|
599
|
-
};
|
|
600
|
-
/**
|
|
601
|
-
* Materialize the current draft into a permanent message.
|
|
602
|
-
* For draft transport: sends the accumulated text as a real sendMessage.
|
|
603
|
-
* For message transport: the message is already permanent (noop).
|
|
604
|
-
* Returns the permanent message id, or undefined if nothing to materialize.
|
|
605
|
-
*/
|
|
606
|
-
const materialize = async () => {
|
|
607
|
-
await stop();
|
|
608
|
-
if (previewTransport === "message" && typeof streamMessageId === "number") return streamMessageId;
|
|
609
|
-
const renderedText = lastSentText || lastDeliveredText;
|
|
610
|
-
if (!renderedText) return;
|
|
611
|
-
const renderedParseMode = lastSentText ? lastSentParseMode : void 0;
|
|
612
|
-
try {
|
|
613
|
-
const { sent, usedThreadParams } = await sendRenderedMessageWithThreadFallback({
|
|
614
|
-
renderedText,
|
|
615
|
-
renderedParseMode,
|
|
616
|
-
fallbackWarnMessage: "telegram stream preview materialize send failed with message_thread_id, retrying without thread"
|
|
617
|
-
});
|
|
618
|
-
const sentId = sent?.message_id;
|
|
619
|
-
if (typeof sentId === "number" && Number.isFinite(sentId)) {
|
|
620
|
-
streamMessageId = Math.trunc(sentId);
|
|
621
|
-
if (resolvedDraftApi != null && streamDraftId != null) {
|
|
622
|
-
const clearDraftId = streamDraftId;
|
|
623
|
-
const clearThreadParams = usedThreadParams && threadParams?.message_thread_id != null ? { message_thread_id: threadParams.message_thread_id } : void 0;
|
|
624
|
-
try {
|
|
625
|
-
await resolvedDraftApi(chatId, clearDraftId, "", clearThreadParams);
|
|
626
|
-
} catch {}
|
|
627
|
-
}
|
|
628
|
-
return streamMessageId;
|
|
629
|
-
}
|
|
630
|
-
} catch (err) {
|
|
631
|
-
params.warn?.(`telegram stream preview materialize failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
632
|
-
}
|
|
633
|
-
};
|
|
634
|
-
params.log?.(`telegram stream preview ready (maxChars=${maxChars}, throttleMs=${throttleMs})`);
|
|
635
|
-
return {
|
|
636
|
-
update,
|
|
637
|
-
flush: loop.flush,
|
|
638
|
-
messageId: () => streamMessageId,
|
|
639
|
-
previewMode: () => previewTransport,
|
|
640
|
-
previewRevision: () => previewRevision,
|
|
641
|
-
lastDeliveredText: () => lastDeliveredText,
|
|
642
|
-
clear,
|
|
643
|
-
stop,
|
|
644
|
-
materialize,
|
|
645
|
-
forceNewMessage,
|
|
646
|
-
sendMayHaveLanded: () => messageSendAttempted && typeof streamMessageId !== "number"
|
|
647
|
-
};
|
|
648
|
-
}
|
|
649
|
-
//#endregion
|
|
650
|
-
//#region extensions/telegram/src/exec-approval-resolver.ts
|
|
651
|
-
const INVALID_REQUEST = "INVALID_REQUEST";
|
|
652
|
-
const APPROVAL_NOT_FOUND = "APPROVAL_NOT_FOUND";
|
|
653
|
-
function readErrorCode(value) {
|
|
654
|
-
return typeof value === "string" && value.trim() ? value : null;
|
|
655
|
-
}
|
|
656
|
-
function readApprovalNotFoundDetailsReason(value) {
|
|
657
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
658
|
-
const reason = value.reason;
|
|
659
|
-
return typeof reason === "string" && reason.trim() ? reason : null;
|
|
660
|
-
}
|
|
661
|
-
function isApprovalNotFoundError(err) {
|
|
662
|
-
if (!(err instanceof Error)) return false;
|
|
663
|
-
const gatewayCode = readErrorCode(err.gatewayCode);
|
|
664
|
-
if (gatewayCode === APPROVAL_NOT_FOUND) return true;
|
|
665
|
-
const detailsReason = readApprovalNotFoundDetailsReason(err.details);
|
|
666
|
-
if (gatewayCode === INVALID_REQUEST && detailsReason === APPROVAL_NOT_FOUND) return true;
|
|
667
|
-
return /unknown or expired approval id/i.test(err.message);
|
|
668
|
-
}
|
|
669
|
-
async function resolveTelegramExecApproval(params) {
|
|
670
|
-
let readySettled = false;
|
|
671
|
-
let resolveReady;
|
|
672
|
-
let rejectReady;
|
|
673
|
-
const ready = new Promise((resolve, reject) => {
|
|
674
|
-
resolveReady = resolve;
|
|
675
|
-
rejectReady = reject;
|
|
676
|
-
});
|
|
677
|
-
const markReady = () => {
|
|
678
|
-
if (readySettled) return;
|
|
679
|
-
readySettled = true;
|
|
680
|
-
resolveReady();
|
|
681
|
-
};
|
|
682
|
-
const failReady = (err) => {
|
|
683
|
-
if (readySettled) return;
|
|
684
|
-
readySettled = true;
|
|
685
|
-
rejectReady(err);
|
|
686
|
-
};
|
|
687
|
-
const gatewayClient = await createOperatorApprovalsGatewayClient({
|
|
688
|
-
config: params.cfg,
|
|
689
|
-
gatewayUrl: params.gatewayUrl,
|
|
690
|
-
clientDisplayName: `Telegram approval (${params.senderId?.trim() || "unknown"})`,
|
|
691
|
-
onHelloOk: () => {
|
|
692
|
-
markReady();
|
|
693
|
-
},
|
|
694
|
-
onConnectError: (err) => {
|
|
695
|
-
failReady(err);
|
|
696
|
-
},
|
|
697
|
-
onClose: (code, reason) => {
|
|
698
|
-
failReady(/* @__PURE__ */ new Error(`gateway closed (${code}): ${reason}`));
|
|
699
|
-
}
|
|
700
|
-
});
|
|
701
|
-
try {
|
|
702
|
-
gatewayClient.start();
|
|
703
|
-
await ready;
|
|
704
|
-
const requestApproval = async (method) => {
|
|
705
|
-
await gatewayClient.request(method, {
|
|
706
|
-
id: params.approvalId,
|
|
707
|
-
decision: params.decision
|
|
708
|
-
});
|
|
709
|
-
};
|
|
710
|
-
if (params.approvalId.startsWith("plugin:")) await requestApproval("plugin.approval.resolve");
|
|
711
|
-
else try {
|
|
712
|
-
await requestApproval("exec.approval.resolve");
|
|
713
|
-
} catch (err) {
|
|
714
|
-
if (!params.allowPluginFallback || !isApprovalNotFoundError(err)) throw err;
|
|
715
|
-
await requestApproval("plugin.approval.resolve");
|
|
716
|
-
}
|
|
717
|
-
} finally {
|
|
718
|
-
await gatewayClient.stopAndWait().catch(() => {
|
|
719
|
-
gatewayClient.stop();
|
|
720
|
-
});
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
//#endregion
|
|
724
|
-
//#region extensions/telegram/src/bot-deps.ts
|
|
725
|
-
const defaultTelegramBotDeps = {
|
|
726
|
-
get loadConfig() {
|
|
727
|
-
return loadConfig;
|
|
728
|
-
},
|
|
729
|
-
get resolveStorePath() {
|
|
730
|
-
return resolveStorePath;
|
|
731
|
-
},
|
|
732
|
-
get readChannelAllowFromStore() {
|
|
733
|
-
return readChannelAllowFromStore;
|
|
734
|
-
},
|
|
735
|
-
get loadSessionStore() {
|
|
736
|
-
return loadSessionStore;
|
|
737
|
-
},
|
|
738
|
-
get upsertChannelPairingRequest() {
|
|
739
|
-
return upsertChannelPairingRequest;
|
|
740
|
-
},
|
|
741
|
-
get enqueueSystemEvent() {
|
|
742
|
-
return enqueueSystemEvent;
|
|
743
|
-
},
|
|
744
|
-
get dispatchReplyWithBufferedBlockDispatcher() {
|
|
745
|
-
return dispatchReplyWithBufferedBlockDispatcher;
|
|
746
|
-
},
|
|
747
|
-
get loadWebMedia() {
|
|
748
|
-
return loadWebMedia;
|
|
749
|
-
},
|
|
750
|
-
get buildModelsProviderData() {
|
|
751
|
-
return buildModelsProviderData;
|
|
752
|
-
},
|
|
753
|
-
get listSkillCommandsForAgents() {
|
|
754
|
-
return listSkillCommandsForAgents;
|
|
755
|
-
},
|
|
756
|
-
get syncTelegramMenuCommands() {
|
|
757
|
-
return syncTelegramMenuCommands;
|
|
758
|
-
},
|
|
759
|
-
get wasSentByBot() {
|
|
760
|
-
return wasSentByBot;
|
|
761
|
-
},
|
|
762
|
-
get resolveExecApproval() {
|
|
763
|
-
return resolveTelegramExecApproval;
|
|
764
|
-
},
|
|
765
|
-
get createTelegramDraftStream() {
|
|
766
|
-
return createTelegramDraftStream;
|
|
767
|
-
},
|
|
768
|
-
get deliverReplies() {
|
|
769
|
-
return deliverReplies;
|
|
770
|
-
},
|
|
771
|
-
get emitInternalMessageSentHook() {
|
|
772
|
-
return emitInternalMessageSentHook;
|
|
773
|
-
},
|
|
774
|
-
get editMessageTelegram() {
|
|
775
|
-
return editMessageTelegram;
|
|
776
|
-
},
|
|
777
|
-
get createChannelReplyPipeline() {
|
|
778
|
-
return createChannelReplyPipeline;
|
|
779
|
-
}
|
|
780
|
-
};
|
|
781
|
-
//#endregion
|
|
782
|
-
//#region extensions/telegram/src/bot-handlers.media.ts
|
|
783
|
-
function isMediaSizeLimitError(err) {
|
|
784
|
-
const errMsg = String(err);
|
|
785
|
-
return errMsg.includes("exceeds") && errMsg.includes("MB limit");
|
|
786
|
-
}
|
|
787
|
-
function isRecoverableMediaGroupError(err) {
|
|
788
|
-
return err instanceof MediaFetchError || isMediaSizeLimitError(err);
|
|
789
|
-
}
|
|
790
|
-
function hasInboundMedia(msg) {
|
|
791
|
-
return Boolean(msg.media_group_id) || Array.isArray(msg.photo) && msg.photo.length > 0 || Boolean(msg.video ?? msg.video_note ?? msg.document ?? msg.audio ?? msg.voice ?? msg.sticker);
|
|
792
|
-
}
|
|
793
|
-
function hasReplyTargetMedia(msg) {
|
|
794
|
-
const externalReply = msg.external_reply;
|
|
795
|
-
const replyTarget = msg.reply_to_message ?? externalReply;
|
|
796
|
-
return Boolean(replyTarget && hasInboundMedia(replyTarget));
|
|
797
|
-
}
|
|
798
|
-
function resolveInboundMediaFileId(msg) {
|
|
799
|
-
return msg.sticker?.file_id ?? msg.photo?.[msg.photo.length - 1]?.file_id ?? msg.video?.file_id ?? msg.video_note?.file_id ?? msg.document?.file_id ?? msg.audio?.file_id ?? msg.voice?.file_id;
|
|
800
|
-
}
|
|
801
|
-
//#endregion
|
|
802
|
-
//#region extensions/telegram/src/bot-native-commands.ts
|
|
803
|
-
const EMPTY_RESPONSE_FALLBACK$1 = "No response generated. Please try again.";
|
|
804
|
-
const TELEGRAM_NATIVE_COMMAND_CALLBACK_PREFIX = "tgcmd:";
|
|
805
|
-
let telegramNativeCommandDeliveryRuntimePromise;
|
|
806
|
-
async function loadTelegramNativeCommandDeliveryRuntime() {
|
|
807
|
-
telegramNativeCommandDeliveryRuntimePromise ??= import("./bot-native-commands.delivery.runtime-CgfbR-Nj.js");
|
|
808
|
-
return await telegramNativeCommandDeliveryRuntimePromise;
|
|
809
|
-
}
|
|
810
|
-
let telegramNativeCommandRuntimePromise;
|
|
811
|
-
async function loadTelegramNativeCommandRuntime() {
|
|
812
|
-
telegramNativeCommandRuntimePromise ??= import("./bot-native-commands.runtime-DCz7w0aK.js");
|
|
813
|
-
return await telegramNativeCommandRuntimePromise;
|
|
814
|
-
}
|
|
815
|
-
function resolveTelegramProgressPlaceholder(command) {
|
|
816
|
-
const text = command.telegramNativeProgressMessage?.trim();
|
|
817
|
-
return text ? text : null;
|
|
818
|
-
}
|
|
819
|
-
function resolveTelegramNativeReplyChannelData(result) {
|
|
820
|
-
return result.channelData?.telegram;
|
|
821
|
-
}
|
|
822
|
-
function isEditableTelegramProgressResult(result) {
|
|
823
|
-
const telegramData = resolveTelegramNativeReplyChannelData(result);
|
|
824
|
-
return Boolean(typeof result.text === "string" && result.text.trim() && !result.mediaUrl && (!result.mediaUrls || result.mediaUrls.length === 0) && !result.interactive && !result.btw && telegramData?.pin !== true);
|
|
825
|
-
}
|
|
826
|
-
async function cleanupTelegramProgressPlaceholder(params) {
|
|
827
|
-
const progressMessageId = params.progressMessageId;
|
|
828
|
-
if (progressMessageId == null) return;
|
|
829
|
-
try {
|
|
830
|
-
await withTelegramApiErrorLogging({
|
|
831
|
-
operation: "deleteMessage",
|
|
832
|
-
runtime: params.runtime,
|
|
833
|
-
fn: () => params.bot.api.deleteMessage(params.chatId, progressMessageId)
|
|
834
|
-
});
|
|
835
|
-
} catch {}
|
|
836
|
-
}
|
|
837
|
-
function buildTelegramNativeCommandCallbackData(commandText) {
|
|
838
|
-
return `${TELEGRAM_NATIVE_COMMAND_CALLBACK_PREFIX}${commandText}`;
|
|
839
|
-
}
|
|
840
|
-
function parseTelegramNativeCommandCallbackData(data) {
|
|
841
|
-
if (!data) return null;
|
|
842
|
-
const trimmed = data.trim();
|
|
843
|
-
if (!trimmed.startsWith(TELEGRAM_NATIVE_COMMAND_CALLBACK_PREFIX)) return null;
|
|
844
|
-
const commandText = trimmed.slice(6).trim();
|
|
845
|
-
return commandText.startsWith("/") ? commandText : null;
|
|
846
|
-
}
|
|
847
|
-
async function resolveTelegramCommandAuth(params) {
|
|
848
|
-
const { msg, bot, cfg, accountId, telegramCfg, readChannelAllowFromStore, allowFrom, groupAllowFrom, useAccessGroups, resolveGroupPolicy, resolveTelegramGroupConfig, requireAuth } = params;
|
|
849
|
-
const chatId = msg.chat.id;
|
|
850
|
-
const isGroup = msg.chat.type === "group" || msg.chat.type === "supergroup";
|
|
851
|
-
const messageThreadId = msg.message_thread_id;
|
|
852
|
-
const getChat = typeof bot.api.getChat === "function" ? bot.api.getChat.bind(bot.api) : void 0;
|
|
853
|
-
const isForum = await resolveTelegramForumFlag({
|
|
854
|
-
chatId,
|
|
855
|
-
chatType: msg.chat.type,
|
|
856
|
-
isGroup,
|
|
857
|
-
isForum: extractTelegramForumFlag(msg.chat),
|
|
858
|
-
getChat
|
|
859
|
-
});
|
|
860
|
-
const threadParams = buildTelegramThreadParams(resolveTelegramThreadSpec({
|
|
861
|
-
isGroup,
|
|
862
|
-
isForum,
|
|
863
|
-
messageThreadId
|
|
864
|
-
})) ?? {};
|
|
865
|
-
const { resolvedThreadId, dmThreadId, storeAllowFrom, groupConfig, topicConfig, groupAllowOverride, effectiveGroupAllow, hasGroupAllowOverride } = await resolveTelegramGroupAllowFromContext({
|
|
866
|
-
chatId,
|
|
867
|
-
accountId,
|
|
868
|
-
isGroup,
|
|
869
|
-
isForum,
|
|
870
|
-
messageThreadId,
|
|
871
|
-
groupAllowFrom,
|
|
872
|
-
readChannelAllowFromStore,
|
|
873
|
-
resolveTelegramGroupConfig
|
|
874
|
-
});
|
|
875
|
-
const effectiveDmPolicy = !isGroup && groupConfig && "dmPolicy" in groupConfig ? groupConfig.dmPolicy ?? telegramCfg.dmPolicy ?? "pairing" : telegramCfg.dmPolicy ?? "pairing";
|
|
876
|
-
const requireTopic = groupConfig?.requireTopic;
|
|
877
|
-
if (!isGroup && requireTopic === true && dmThreadId == null) {
|
|
878
|
-
logVerbose(`Blocked telegram command in DM ${chatId}: requireTopic=true but no topic present`);
|
|
879
|
-
return null;
|
|
880
|
-
}
|
|
881
|
-
const dmAllowFrom = groupAllowOverride ?? allowFrom;
|
|
882
|
-
const senderId = msg.from?.id ? String(msg.from.id) : "";
|
|
883
|
-
const senderUsername = msg.from?.username ?? "";
|
|
884
|
-
const commandsAllowFrom = cfg.commands?.allowFrom;
|
|
885
|
-
const commandsAllowFromConfigured = commandsAllowFrom != null && typeof commandsAllowFrom === "object" && (Array.isArray(commandsAllowFrom.telegram) || Array.isArray(commandsAllowFrom["*"]));
|
|
886
|
-
const commandsAllowFromAccess = commandsAllowFromConfigured ? resolveCommandAuthorization({
|
|
887
|
-
ctx: {
|
|
888
|
-
Provider: "telegram",
|
|
889
|
-
Surface: "telegram",
|
|
890
|
-
OriginatingChannel: "telegram",
|
|
891
|
-
AccountId: accountId,
|
|
892
|
-
ChatType: isGroup ? "group" : "direct",
|
|
893
|
-
From: isGroup ? buildTelegramGroupFrom(chatId, resolvedThreadId) : `telegram:${chatId}`,
|
|
894
|
-
SenderId: senderId || void 0,
|
|
895
|
-
SenderUsername: senderUsername || void 0
|
|
896
|
-
},
|
|
897
|
-
cfg,
|
|
898
|
-
commandAuthorized: false
|
|
899
|
-
}) : null;
|
|
900
|
-
const sendAuthMessage = async (text) => {
|
|
901
|
-
await withTelegramApiErrorLogging({
|
|
902
|
-
operation: "sendMessage",
|
|
903
|
-
fn: () => bot.api.sendMessage(chatId, text, threadParams)
|
|
904
|
-
});
|
|
905
|
-
return null;
|
|
906
|
-
};
|
|
907
|
-
const rejectNotAuthorized = async () => {
|
|
908
|
-
return await sendAuthMessage("You are not authorized to use this command.");
|
|
909
|
-
};
|
|
910
|
-
const baseAccess = evaluateTelegramGroupBaseAccess({
|
|
911
|
-
isGroup,
|
|
912
|
-
groupConfig,
|
|
913
|
-
topicConfig,
|
|
914
|
-
hasGroupAllowOverride,
|
|
915
|
-
effectiveGroupAllow,
|
|
916
|
-
senderId,
|
|
917
|
-
senderUsername,
|
|
918
|
-
enforceAllowOverride: requireAuth,
|
|
919
|
-
requireSenderForAllowOverride: true
|
|
920
|
-
});
|
|
921
|
-
if (!baseAccess.allowed) {
|
|
922
|
-
if (baseAccess.reason === "group-disabled") return await sendAuthMessage("This group is disabled.");
|
|
923
|
-
if (baseAccess.reason === "topic-disabled") return await sendAuthMessage("This topic is disabled.");
|
|
924
|
-
return await rejectNotAuthorized();
|
|
925
|
-
}
|
|
926
|
-
const policyAccess = evaluateTelegramGroupPolicyAccess({
|
|
927
|
-
isGroup,
|
|
928
|
-
chatId,
|
|
929
|
-
cfg,
|
|
930
|
-
telegramCfg,
|
|
931
|
-
topicConfig,
|
|
932
|
-
groupConfig,
|
|
933
|
-
effectiveGroupAllow,
|
|
934
|
-
senderId,
|
|
935
|
-
senderUsername,
|
|
936
|
-
resolveGroupPolicy,
|
|
937
|
-
enforcePolicy: useAccessGroups,
|
|
938
|
-
useTopicAndGroupOverrides: false,
|
|
939
|
-
enforceAllowlistAuthorization: requireAuth && !commandsAllowFromConfigured,
|
|
940
|
-
allowEmptyAllowlistEntries: true,
|
|
941
|
-
requireSenderForAllowlistAuthorization: true,
|
|
942
|
-
checkChatAllowlist: useAccessGroups
|
|
943
|
-
});
|
|
944
|
-
if (!policyAccess.allowed) {
|
|
945
|
-
if (policyAccess.reason === "group-policy-disabled") return await sendAuthMessage("Telegram group commands are disabled.");
|
|
946
|
-
if (policyAccess.reason === "group-policy-allowlist-no-sender" || policyAccess.reason === "group-policy-allowlist-unauthorized") return await rejectNotAuthorized();
|
|
947
|
-
if (policyAccess.reason === "group-chat-not-allowed") return await sendAuthMessage("This group is not allowed.");
|
|
948
|
-
}
|
|
949
|
-
const dmAllow = normalizeDmAllowFromWithStore({
|
|
950
|
-
allowFrom: dmAllowFrom,
|
|
951
|
-
storeAllowFrom: isGroup ? [] : storeAllowFrom,
|
|
952
|
-
dmPolicy: effectiveDmPolicy
|
|
953
|
-
});
|
|
954
|
-
const senderAllowed = isSenderAllowed({
|
|
955
|
-
allow: dmAllow,
|
|
956
|
-
senderId,
|
|
957
|
-
senderUsername
|
|
958
|
-
});
|
|
959
|
-
const groupSenderAllowed = isGroup ? isSenderAllowed({
|
|
960
|
-
allow: effectiveGroupAllow,
|
|
961
|
-
senderId,
|
|
962
|
-
senderUsername
|
|
963
|
-
}) : false;
|
|
964
|
-
const commandAuthorized = commandsAllowFromConfigured ? Boolean(commandsAllowFromAccess?.isAuthorizedSender) : resolveCommandAuthorizedFromAuthorizers({
|
|
965
|
-
useAccessGroups,
|
|
966
|
-
authorizers: [{
|
|
967
|
-
configured: dmAllow.hasEntries,
|
|
968
|
-
allowed: senderAllowed
|
|
969
|
-
}, ...isGroup ? [{
|
|
970
|
-
configured: effectiveGroupAllow.hasEntries,
|
|
971
|
-
allowed: groupSenderAllowed
|
|
972
|
-
}] : []],
|
|
973
|
-
modeWhenAccessGroupsOff: "configured"
|
|
974
|
-
});
|
|
975
|
-
if (requireAuth && !commandAuthorized) return await rejectNotAuthorized();
|
|
976
|
-
return {
|
|
977
|
-
chatId,
|
|
978
|
-
isGroup,
|
|
979
|
-
isForum,
|
|
980
|
-
resolvedThreadId,
|
|
981
|
-
senderId,
|
|
982
|
-
senderUsername,
|
|
983
|
-
groupConfig,
|
|
984
|
-
topicConfig,
|
|
985
|
-
commandAuthorized
|
|
986
|
-
};
|
|
987
|
-
}
|
|
988
|
-
const registerTelegramNativeCommands = ({ bot, cfg, runtime, accountId, telegramCfg, allowFrom, groupAllowFrom, replyToMode, textLimit, useAccessGroups, nativeEnabled, nativeSkillsEnabled, nativeDisabledExplicit, resolveGroupPolicy, resolveTelegramGroupConfig, shouldSkipUpdate, telegramDeps = defaultTelegramBotDeps, opts }) => {
|
|
989
|
-
const boundRoute = nativeEnabled && nativeSkillsEnabled ? resolveAgentRoute({
|
|
990
|
-
cfg,
|
|
991
|
-
channel: "telegram",
|
|
992
|
-
accountId
|
|
993
|
-
}) : null;
|
|
994
|
-
if (nativeEnabled && nativeSkillsEnabled && !boundRoute) runtime.log?.("nativeSkillsEnabled is true but no agent route is bound for this Telegram account; skill commands will not appear in the native menu.");
|
|
995
|
-
const skillCommands = nativeEnabled && nativeSkillsEnabled && boundRoute ? telegramDeps.listSkillCommandsForAgents({
|
|
996
|
-
cfg,
|
|
997
|
-
agentIds: [boundRoute.agentId]
|
|
998
|
-
}) : [];
|
|
999
|
-
const nativeCommands = nativeEnabled ? listNativeCommandSpecsForConfig(cfg, {
|
|
1000
|
-
skillCommands,
|
|
1001
|
-
provider: "telegram"
|
|
1002
|
-
}) : [];
|
|
1003
|
-
const reservedCommands = new Set(listNativeCommandSpecs().map((command) => normalizeTelegramCommandName(command.name)));
|
|
1004
|
-
for (const command of skillCommands) reservedCommands.add(command.name.toLowerCase());
|
|
1005
|
-
const customResolution = resolveTelegramCustomCommands({
|
|
1006
|
-
commands: telegramCfg.customCommands,
|
|
1007
|
-
reservedCommands
|
|
1008
|
-
});
|
|
1009
|
-
for (const issue of customResolution.issues) runtime.error?.(danger(issue.message));
|
|
1010
|
-
const customCommands = customResolution.commands;
|
|
1011
|
-
const pluginCatalog = buildPluginTelegramMenuCommands({
|
|
1012
|
-
specs: getPluginCommandSpecs("telegram"),
|
|
1013
|
-
existingCommands: new Set([...nativeCommands.map((command) => normalizeTelegramCommandName(command.name)), ...customCommands.map((command) => command.command)].map((command) => command.toLowerCase()))
|
|
1014
|
-
});
|
|
1015
|
-
for (const issue of pluginCatalog.issues) runtime.error?.(danger(issue));
|
|
1016
|
-
const loadFreshRuntimeConfig = () => telegramDeps.loadConfig();
|
|
1017
|
-
const resolveFreshTelegramConfig = (runtimeCfg) => {
|
|
1018
|
-
try {
|
|
1019
|
-
return resolveTelegramAccount({
|
|
1020
|
-
cfg: runtimeCfg,
|
|
1021
|
-
accountId
|
|
1022
|
-
}).config;
|
|
1023
|
-
} catch (error) {
|
|
1024
|
-
logVerbose(`telegram native command: failed to load fresh account config for ${accountId}; using startup snapshot: ${String(error)}`);
|
|
1025
|
-
return telegramCfg;
|
|
1026
|
-
}
|
|
1027
|
-
};
|
|
1028
|
-
const { commandsToRegister, totalCommands, maxCommands, overflowCount } = buildCappedTelegramMenuCommands({ allCommands: [
|
|
1029
|
-
...nativeCommands.map((command) => {
|
|
1030
|
-
const normalized = normalizeTelegramCommandName(command.name);
|
|
1031
|
-
if (!TELEGRAM_COMMAND_NAME_PATTERN.test(normalized)) {
|
|
1032
|
-
runtime.error?.(danger(`Native command "${command.name}" is invalid for Telegram (resolved to "${normalized}"). Skipping.`));
|
|
1033
|
-
return null;
|
|
1034
|
-
}
|
|
1035
|
-
return {
|
|
1036
|
-
command: normalized,
|
|
1037
|
-
description: command.description
|
|
1038
|
-
};
|
|
1039
|
-
}).filter((cmd) => cmd !== null),
|
|
1040
|
-
...nativeEnabled ? pluginCatalog.commands : [],
|
|
1041
|
-
...customCommands
|
|
1042
|
-
] });
|
|
1043
|
-
if (overflowCount > 0) runtime.log?.(`Telegram limits bots to ${maxCommands} commands. ${totalCommands} configured; registering first ${maxCommands}. Use channels.telegram.commands.native: false to disable, or reduce plugin/skill/custom commands.`);
|
|
1044
|
-
(telegramDeps.syncTelegramMenuCommands ?? syncTelegramMenuCommands)({
|
|
1045
|
-
bot,
|
|
1046
|
-
runtime,
|
|
1047
|
-
commandsToRegister,
|
|
1048
|
-
accountId,
|
|
1049
|
-
botIdentity: opts.token
|
|
1050
|
-
});
|
|
1051
|
-
const resolveCommandRuntimeContext = async (params) => {
|
|
1052
|
-
const { msg, runtimeCfg, isGroup, isForum, resolvedThreadId, senderId, topicAgentId } = params;
|
|
1053
|
-
const chatId = msg.chat.id;
|
|
1054
|
-
const messageThreadId = msg.message_thread_id;
|
|
1055
|
-
const threadSpec = resolveTelegramThreadSpec({
|
|
1056
|
-
isGroup,
|
|
1057
|
-
isForum,
|
|
1058
|
-
messageThreadId: resolvedThreadId ?? messageThreadId
|
|
1059
|
-
});
|
|
1060
|
-
let { route, configuredBinding } = resolveTelegramConversationRoute({
|
|
1061
|
-
cfg: runtimeCfg,
|
|
1062
|
-
accountId,
|
|
1063
|
-
chatId,
|
|
1064
|
-
isGroup,
|
|
1065
|
-
resolvedThreadId,
|
|
1066
|
-
replyThreadId: threadSpec.id,
|
|
1067
|
-
senderId,
|
|
1068
|
-
topicAgentId
|
|
1069
|
-
});
|
|
1070
|
-
const nativeCommandRuntime = await loadTelegramNativeCommandRuntime();
|
|
1071
|
-
if (configuredBinding) {
|
|
1072
|
-
const ensured = await nativeCommandRuntime.ensureConfiguredBindingRouteReady({
|
|
1073
|
-
cfg: runtimeCfg,
|
|
1074
|
-
bindingResolution: configuredBinding
|
|
1075
|
-
});
|
|
1076
|
-
if (!ensured.ok) {
|
|
1077
|
-
logVerbose(`telegram native command: configured ACP binding unavailable for topic ${configuredBinding.record.conversation.conversationId}: ${ensured.error}`);
|
|
1078
|
-
await withTelegramApiErrorLogging({
|
|
1079
|
-
operation: "sendMessage",
|
|
1080
|
-
runtime,
|
|
1081
|
-
fn: () => bot.api.sendMessage(chatId, "Configured ACP binding is unavailable right now. Please try again.", buildTelegramThreadParams(threadSpec) ?? {})
|
|
1082
|
-
});
|
|
1083
|
-
return null;
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
return {
|
|
1087
|
-
chatId,
|
|
1088
|
-
threadSpec,
|
|
1089
|
-
route,
|
|
1090
|
-
mediaLocalRoots: nativeCommandRuntime.getAgentScopedMediaLocalRoots(runtimeCfg, route.agentId),
|
|
1091
|
-
tableMode: resolveMarkdownTableMode({
|
|
1092
|
-
cfg: runtimeCfg,
|
|
1093
|
-
channel: "telegram",
|
|
1094
|
-
accountId: route.accountId
|
|
1095
|
-
}),
|
|
1096
|
-
chunkMode: nativeCommandRuntime.resolveChunkMode(runtimeCfg, "telegram", route.accountId)
|
|
1097
|
-
};
|
|
1098
|
-
};
|
|
1099
|
-
const buildCommandDeliveryBaseOptions = (params) => ({
|
|
1100
|
-
chatId: String(params.chatId),
|
|
1101
|
-
accountId: params.accountId,
|
|
1102
|
-
sessionKeyForInternalHooks: params.sessionKeyForInternalHooks,
|
|
1103
|
-
mirrorIsGroup: params.mirrorIsGroup,
|
|
1104
|
-
mirrorGroupId: params.mirrorGroupId,
|
|
1105
|
-
token: opts.token,
|
|
1106
|
-
runtime,
|
|
1107
|
-
bot,
|
|
1108
|
-
mediaLocalRoots: params.mediaLocalRoots,
|
|
1109
|
-
replyToMode,
|
|
1110
|
-
textLimit,
|
|
1111
|
-
thread: params.threadSpec,
|
|
1112
|
-
tableMode: params.tableMode,
|
|
1113
|
-
chunkMode: params.chunkMode,
|
|
1114
|
-
linkPreview: params.linkPreview
|
|
1115
|
-
});
|
|
1116
|
-
if (commandsToRegister.length > 0 || pluginCatalog.commands.length > 0) {
|
|
1117
|
-
for (const command of nativeCommands) {
|
|
1118
|
-
const normalizedCommandName = normalizeTelegramCommandName(command.name);
|
|
1119
|
-
bot.command(normalizedCommandName, async (ctx) => {
|
|
1120
|
-
const msg = ctx.message;
|
|
1121
|
-
if (!msg) return;
|
|
1122
|
-
if (shouldSkipUpdate(ctx)) return;
|
|
1123
|
-
const runtimeCfg = loadFreshRuntimeConfig();
|
|
1124
|
-
const runtimeTelegramCfg = resolveFreshTelegramConfig(runtimeCfg);
|
|
1125
|
-
const auth = await resolveTelegramCommandAuth({
|
|
1126
|
-
msg,
|
|
1127
|
-
bot,
|
|
1128
|
-
cfg: runtimeCfg,
|
|
1129
|
-
accountId,
|
|
1130
|
-
telegramCfg: runtimeTelegramCfg,
|
|
1131
|
-
readChannelAllowFromStore: telegramDeps.readChannelAllowFromStore,
|
|
1132
|
-
allowFrom,
|
|
1133
|
-
groupAllowFrom,
|
|
1134
|
-
useAccessGroups,
|
|
1135
|
-
resolveGroupPolicy,
|
|
1136
|
-
resolveTelegramGroupConfig,
|
|
1137
|
-
requireAuth: true
|
|
1138
|
-
});
|
|
1139
|
-
if (!auth) return;
|
|
1140
|
-
const { chatId, isGroup, isForum, resolvedThreadId, senderId, senderUsername, groupConfig, topicConfig, commandAuthorized } = auth;
|
|
1141
|
-
const runtimeContext = await resolveCommandRuntimeContext({
|
|
1142
|
-
msg,
|
|
1143
|
-
runtimeCfg,
|
|
1144
|
-
isGroup,
|
|
1145
|
-
isForum,
|
|
1146
|
-
resolvedThreadId,
|
|
1147
|
-
senderId,
|
|
1148
|
-
topicAgentId: topicConfig?.agentId
|
|
1149
|
-
});
|
|
1150
|
-
if (!runtimeContext) return;
|
|
1151
|
-
const { threadSpec, route, mediaLocalRoots, tableMode, chunkMode } = runtimeContext;
|
|
1152
|
-
const threadParams = buildTelegramThreadParams(threadSpec) ?? {};
|
|
1153
|
-
const originatingTo = buildTelegramRoutingTarget(chatId, threadSpec);
|
|
1154
|
-
const executionCfg = getRuntimeConfigSnapshot() ?? cfg;
|
|
1155
|
-
const commandDefinition = findCommandByNativeName(command.name, "telegram");
|
|
1156
|
-
const rawText = ctx.match?.trim() ?? "";
|
|
1157
|
-
const commandArgs = commandDefinition ? parseCommandArgs(commandDefinition, rawText) : rawText ? { raw: rawText } : void 0;
|
|
1158
|
-
const prompt = commandDefinition ? buildCommandTextFromArgs(commandDefinition, commandArgs) : rawText ? `/${command.name} ${rawText}` : `/${command.name}`;
|
|
1159
|
-
const menu = commandDefinition ? resolveCommandArgMenu({
|
|
1160
|
-
command: commandDefinition,
|
|
1161
|
-
args: commandArgs,
|
|
1162
|
-
cfg: runtimeCfg
|
|
1163
|
-
}) : null;
|
|
1164
|
-
if (menu && commandDefinition) {
|
|
1165
|
-
const title = menu.title ?? `Choose ${menu.arg.description || menu.arg.name} for /${commandDefinition.nativeName ?? commandDefinition.key}.`;
|
|
1166
|
-
const rows = [];
|
|
1167
|
-
for (let i = 0; i < menu.choices.length; i += 2) {
|
|
1168
|
-
const slice = menu.choices.slice(i, i + 2);
|
|
1169
|
-
rows.push(slice.map((choice) => {
|
|
1170
|
-
const args = { values: { [menu.arg.name]: choice.value } };
|
|
1171
|
-
return {
|
|
1172
|
-
text: choice.label,
|
|
1173
|
-
callback_data: buildTelegramNativeCommandCallbackData(buildCommandTextFromArgs(commandDefinition, args))
|
|
1174
|
-
};
|
|
1175
|
-
}));
|
|
1176
|
-
}
|
|
1177
|
-
const replyMarkup = buildInlineKeyboard(rows);
|
|
1178
|
-
await withTelegramApiErrorLogging({
|
|
1179
|
-
operation: "sendMessage",
|
|
1180
|
-
runtime,
|
|
1181
|
-
fn: () => bot.api.sendMessage(chatId, title, {
|
|
1182
|
-
...replyMarkup ? { reply_markup: replyMarkup } : {},
|
|
1183
|
-
...threadParams
|
|
1184
|
-
})
|
|
1185
|
-
});
|
|
1186
|
-
return;
|
|
1187
|
-
}
|
|
1188
|
-
const baseSessionKey = resolveTelegramConversationBaseSessionKey({
|
|
1189
|
-
cfg: runtimeCfg,
|
|
1190
|
-
route,
|
|
1191
|
-
chatId,
|
|
1192
|
-
isGroup,
|
|
1193
|
-
senderId
|
|
1194
|
-
});
|
|
1195
|
-
const dmThreadId = threadSpec.scope === "dm" ? threadSpec.id : void 0;
|
|
1196
|
-
const nativeCommandRuntime = await loadTelegramNativeCommandRuntime();
|
|
1197
|
-
const sessionKey = (dmThreadId != null ? nativeCommandRuntime.resolveThreadSessionKeys({
|
|
1198
|
-
baseSessionKey,
|
|
1199
|
-
threadId: `${chatId}:${dmThreadId}`
|
|
1200
|
-
}) : null)?.sessionKey ?? baseSessionKey;
|
|
1201
|
-
const { skillFilter, groupSystemPrompt } = resolveTelegramGroupPromptSettings({
|
|
1202
|
-
groupConfig,
|
|
1203
|
-
topicConfig
|
|
1204
|
-
});
|
|
1205
|
-
const { sessionKey: commandSessionKey, commandTargetSessionKey } = resolveNativeCommandSessionTargets({
|
|
1206
|
-
agentId: route.agentId,
|
|
1207
|
-
sessionPrefix: "telegram:slash",
|
|
1208
|
-
userId: String(senderId || chatId),
|
|
1209
|
-
targetSessionKey: sessionKey
|
|
1210
|
-
});
|
|
1211
|
-
const deliveryBaseOptions = buildCommandDeliveryBaseOptions({
|
|
1212
|
-
chatId,
|
|
1213
|
-
accountId: route.accountId,
|
|
1214
|
-
sessionKeyForInternalHooks: commandSessionKey,
|
|
1215
|
-
mirrorIsGroup: isGroup,
|
|
1216
|
-
mirrorGroupId: isGroup ? String(chatId) : void 0,
|
|
1217
|
-
mediaLocalRoots,
|
|
1218
|
-
threadSpec,
|
|
1219
|
-
tableMode,
|
|
1220
|
-
chunkMode,
|
|
1221
|
-
linkPreview: runtimeTelegramCfg.linkPreview
|
|
1222
|
-
});
|
|
1223
|
-
const conversationLabel = isGroup ? msg.chat.title ? `${msg.chat.title} id:${chatId}` : `group:${chatId}` : buildSenderName(msg) ?? String(senderId || chatId);
|
|
1224
|
-
const ctxPayload = nativeCommandRuntime.finalizeInboundContext({
|
|
1225
|
-
Body: prompt,
|
|
1226
|
-
BodyForAgent: prompt,
|
|
1227
|
-
RawBody: prompt,
|
|
1228
|
-
CommandBody: prompt,
|
|
1229
|
-
CommandArgs: commandArgs,
|
|
1230
|
-
From: isGroup ? buildTelegramGroupFrom(chatId, resolvedThreadId) : `telegram:${chatId}`,
|
|
1231
|
-
To: `slash:${senderId || chatId}`,
|
|
1232
|
-
ChatType: isGroup ? "group" : "direct",
|
|
1233
|
-
ConversationLabel: conversationLabel,
|
|
1234
|
-
GroupSubject: isGroup ? msg.chat.title ?? void 0 : void 0,
|
|
1235
|
-
GroupSystemPrompt: isGroup || !isGroup && groupConfig ? groupSystemPrompt : void 0,
|
|
1236
|
-
SenderName: buildSenderName(msg),
|
|
1237
|
-
SenderId: senderId || void 0,
|
|
1238
|
-
SenderUsername: senderUsername || void 0,
|
|
1239
|
-
Surface: "telegram",
|
|
1240
|
-
Provider: "telegram",
|
|
1241
|
-
MessageSid: String(msg.message_id),
|
|
1242
|
-
Timestamp: msg.date ? msg.date * 1e3 : void 0,
|
|
1243
|
-
WasMentioned: true,
|
|
1244
|
-
CommandAuthorized: commandAuthorized,
|
|
1245
|
-
CommandSource: "native",
|
|
1246
|
-
SessionKey: commandSessionKey,
|
|
1247
|
-
AccountId: route.accountId,
|
|
1248
|
-
CommandTargetSessionKey: commandTargetSessionKey,
|
|
1249
|
-
MessageThreadId: threadSpec.id,
|
|
1250
|
-
IsForum: isForum,
|
|
1251
|
-
OriginatingChannel: "telegram",
|
|
1252
|
-
OriginatingTo: originatingTo
|
|
1253
|
-
});
|
|
1254
|
-
await nativeCommandRuntime.recordInboundSessionMetaSafe({
|
|
1255
|
-
cfg: executionCfg,
|
|
1256
|
-
agentId: route.agentId,
|
|
1257
|
-
sessionKey: ctxPayload.SessionKey ?? route.sessionKey,
|
|
1258
|
-
ctx: ctxPayload,
|
|
1259
|
-
onError: (err) => runtime.error?.(danger(`telegram slash: failed updating session meta: ${String(err)}`))
|
|
1260
|
-
});
|
|
1261
|
-
const disableBlockStreaming = typeof runtimeTelegramCfg.blockStreaming === "boolean" ? !runtimeTelegramCfg.blockStreaming : void 0;
|
|
1262
|
-
const deliveryState = {
|
|
1263
|
-
delivered: false,
|
|
1264
|
-
skippedNonSilent: 0
|
|
1265
|
-
};
|
|
1266
|
-
const { createChannelReplyPipeline, deliverReplies } = await loadTelegramNativeCommandDeliveryRuntime();
|
|
1267
|
-
const { onModelSelected, ...replyPipeline } = createChannelReplyPipeline({
|
|
1268
|
-
cfg: executionCfg,
|
|
1269
|
-
agentId: route.agentId,
|
|
1270
|
-
channel: "telegram",
|
|
1271
|
-
accountId: route.accountId
|
|
1272
|
-
});
|
|
1273
|
-
await telegramDeps.dispatchReplyWithBufferedBlockDispatcher({
|
|
1274
|
-
ctx: ctxPayload,
|
|
1275
|
-
cfg: executionCfg,
|
|
1276
|
-
dispatcherOptions: {
|
|
1277
|
-
...replyPipeline,
|
|
1278
|
-
deliver: async (payload, _info) => {
|
|
1279
|
-
if (shouldSuppressLocalTelegramExecApprovalPrompt({
|
|
1280
|
-
cfg: executionCfg,
|
|
1281
|
-
accountId: route.accountId,
|
|
1282
|
-
payload
|
|
1283
|
-
})) {
|
|
1284
|
-
deliveryState.delivered = true;
|
|
1285
|
-
return;
|
|
1286
|
-
}
|
|
1287
|
-
if ((await deliverReplies({
|
|
1288
|
-
replies: [payload],
|
|
1289
|
-
...deliveryBaseOptions,
|
|
1290
|
-
silent: runtimeTelegramCfg.silentErrorReplies === true && payload.isError === true
|
|
1291
|
-
})).delivered) deliveryState.delivered = true;
|
|
1292
|
-
},
|
|
1293
|
-
onSkip: (_payload, info) => {
|
|
1294
|
-
if (info.reason !== "silent") deliveryState.skippedNonSilent += 1;
|
|
1295
|
-
},
|
|
1296
|
-
onError: (err, info) => {
|
|
1297
|
-
runtime.error?.(danger(`telegram slash ${info.kind} reply failed: ${String(err)}`));
|
|
1298
|
-
}
|
|
1299
|
-
},
|
|
1300
|
-
replyOptions: {
|
|
1301
|
-
skillFilter,
|
|
1302
|
-
disableBlockStreaming,
|
|
1303
|
-
onModelSelected
|
|
1304
|
-
}
|
|
1305
|
-
});
|
|
1306
|
-
if (!deliveryState.delivered && deliveryState.skippedNonSilent > 0) await deliverReplies({
|
|
1307
|
-
replies: [{ text: EMPTY_RESPONSE_FALLBACK$1 }],
|
|
1308
|
-
...deliveryBaseOptions
|
|
1309
|
-
});
|
|
1310
|
-
});
|
|
1311
|
-
}
|
|
1312
|
-
for (const pluginCommand of pluginCatalog.commands) bot.command(pluginCommand.command, async (ctx) => {
|
|
1313
|
-
const msg = ctx.message;
|
|
1314
|
-
if (!msg) return;
|
|
1315
|
-
if (shouldSkipUpdate(ctx)) return;
|
|
1316
|
-
const chatId = msg.chat.id;
|
|
1317
|
-
const runtimeCfg = loadFreshRuntimeConfig();
|
|
1318
|
-
const runtimeTelegramCfg = resolveFreshTelegramConfig(runtimeCfg);
|
|
1319
|
-
const rawText = ctx.match?.trim() ?? "";
|
|
1320
|
-
const commandBody = `/${pluginCommand.command}${rawText ? ` ${rawText}` : ""}`;
|
|
1321
|
-
const nativeCommandRuntime = await loadTelegramNativeCommandRuntime();
|
|
1322
|
-
const match = nativeCommandRuntime.matchPluginCommand(commandBody);
|
|
1323
|
-
if (!match) {
|
|
1324
|
-
await withTelegramApiErrorLogging({
|
|
1325
|
-
operation: "sendMessage",
|
|
1326
|
-
runtime,
|
|
1327
|
-
fn: () => bot.api.sendMessage(chatId, "Command not found.")
|
|
1328
|
-
});
|
|
1329
|
-
return;
|
|
1330
|
-
}
|
|
1331
|
-
const auth = await resolveTelegramCommandAuth({
|
|
1332
|
-
msg,
|
|
1333
|
-
bot,
|
|
1334
|
-
cfg: runtimeCfg,
|
|
1335
|
-
accountId,
|
|
1336
|
-
telegramCfg: runtimeTelegramCfg,
|
|
1337
|
-
readChannelAllowFromStore: telegramDeps.readChannelAllowFromStore,
|
|
1338
|
-
allowFrom,
|
|
1339
|
-
groupAllowFrom,
|
|
1340
|
-
useAccessGroups,
|
|
1341
|
-
resolveGroupPolicy,
|
|
1342
|
-
resolveTelegramGroupConfig,
|
|
1343
|
-
requireAuth: match.command.requireAuth !== false
|
|
1344
|
-
});
|
|
1345
|
-
if (!auth) return;
|
|
1346
|
-
const { senderId, commandAuthorized, isGroup, isForum, resolvedThreadId } = auth;
|
|
1347
|
-
const runtimeContext = await resolveCommandRuntimeContext({
|
|
1348
|
-
msg,
|
|
1349
|
-
runtimeCfg,
|
|
1350
|
-
isGroup,
|
|
1351
|
-
isForum,
|
|
1352
|
-
resolvedThreadId,
|
|
1353
|
-
senderId,
|
|
1354
|
-
topicAgentId: auth.topicConfig?.agentId
|
|
1355
|
-
});
|
|
1356
|
-
if (!runtimeContext) return;
|
|
1357
|
-
const { threadSpec, route, mediaLocalRoots, tableMode, chunkMode } = runtimeContext;
|
|
1358
|
-
const deliveryBaseOptions = buildCommandDeliveryBaseOptions({
|
|
1359
|
-
chatId,
|
|
1360
|
-
accountId: route.accountId,
|
|
1361
|
-
sessionKeyForInternalHooks: route.sessionKey,
|
|
1362
|
-
mirrorIsGroup: isGroup,
|
|
1363
|
-
mirrorGroupId: isGroup ? String(chatId) : void 0,
|
|
1364
|
-
mediaLocalRoots,
|
|
1365
|
-
threadSpec,
|
|
1366
|
-
tableMode,
|
|
1367
|
-
chunkMode,
|
|
1368
|
-
linkPreview: runtimeTelegramCfg.linkPreview
|
|
1369
|
-
});
|
|
1370
|
-
const from = isGroup ? buildTelegramGroupFrom(chatId, threadSpec.id) : `telegram:${chatId}`;
|
|
1371
|
-
const to = `telegram:${chatId}`;
|
|
1372
|
-
const { deliverReplies, emitTelegramMessageSentHooks } = await loadTelegramNativeCommandDeliveryRuntime();
|
|
1373
|
-
let progressMessageId;
|
|
1374
|
-
const progressPlaceholder = resolveTelegramProgressPlaceholder(match.command);
|
|
1375
|
-
if (progressPlaceholder) try {
|
|
1376
|
-
const maybeMessageId = (await withTelegramApiErrorLogging({
|
|
1377
|
-
operation: "sendMessage",
|
|
1378
|
-
runtime,
|
|
1379
|
-
fn: () => bot.api.sendMessage(chatId, progressPlaceholder, buildTelegramThreadParams(threadSpec))
|
|
1380
|
-
}))?.message_id;
|
|
1381
|
-
if (typeof maybeMessageId === "number") progressMessageId = maybeMessageId;
|
|
1382
|
-
} catch {}
|
|
1383
|
-
const result = await nativeCommandRuntime.executePluginCommand({
|
|
1384
|
-
command: match.command,
|
|
1385
|
-
args: match.args,
|
|
1386
|
-
senderId,
|
|
1387
|
-
channel: "telegram",
|
|
1388
|
-
isAuthorizedSender: commandAuthorized,
|
|
1389
|
-
sessionKey: route.sessionKey,
|
|
1390
|
-
commandBody,
|
|
1391
|
-
config: runtimeCfg,
|
|
1392
|
-
from,
|
|
1393
|
-
to,
|
|
1394
|
-
accountId,
|
|
1395
|
-
messageThreadId: threadSpec.id
|
|
1396
|
-
});
|
|
1397
|
-
if (shouldSuppressLocalTelegramExecApprovalPrompt({
|
|
1398
|
-
cfg: runtimeCfg,
|
|
1399
|
-
accountId: route.accountId,
|
|
1400
|
-
payload: result
|
|
1401
|
-
})) {
|
|
1402
|
-
await cleanupTelegramProgressPlaceholder({
|
|
1403
|
-
bot,
|
|
1404
|
-
chatId,
|
|
1405
|
-
progressMessageId,
|
|
1406
|
-
runtime
|
|
1407
|
-
});
|
|
1408
|
-
return;
|
|
1409
|
-
}
|
|
1410
|
-
const progressResultText = typeof result.text === "string" && result.text.trim().length > 0 ? result.text : null;
|
|
1411
|
-
const telegramResultData = resolveTelegramNativeReplyChannelData(result);
|
|
1412
|
-
if (progressMessageId != null && telegramDeps.editMessageTelegram && progressResultText && isEditableTelegramProgressResult(result)) try {
|
|
1413
|
-
await telegramDeps.editMessageTelegram(chatId, progressMessageId, progressResultText, {
|
|
1414
|
-
cfg: runtimeCfg,
|
|
1415
|
-
accountId: route.accountId,
|
|
1416
|
-
textMode: "markdown",
|
|
1417
|
-
linkPreview: runtimeTelegramCfg.linkPreview,
|
|
1418
|
-
buttons: telegramResultData?.buttons
|
|
1419
|
-
});
|
|
1420
|
-
recordSentMessage(chatId, progressMessageId);
|
|
1421
|
-
emitTelegramMessageSentHooks({
|
|
1422
|
-
sessionKeyForInternalHooks: route.sessionKey,
|
|
1423
|
-
chatId: String(chatId),
|
|
1424
|
-
accountId: route.accountId,
|
|
1425
|
-
content: progressResultText,
|
|
1426
|
-
success: true,
|
|
1427
|
-
messageId: progressMessageId,
|
|
1428
|
-
isGroup,
|
|
1429
|
-
groupId: isGroup ? String(chatId) : void 0
|
|
1430
|
-
});
|
|
1431
|
-
return;
|
|
1432
|
-
} catch {}
|
|
1433
|
-
await cleanupTelegramProgressPlaceholder({
|
|
1434
|
-
bot,
|
|
1435
|
-
chatId,
|
|
1436
|
-
progressMessageId,
|
|
1437
|
-
runtime
|
|
1438
|
-
});
|
|
1439
|
-
await deliverReplies({
|
|
1440
|
-
replies: [result],
|
|
1441
|
-
...deliveryBaseOptions,
|
|
1442
|
-
silent: runtimeTelegramCfg.silentErrorReplies === true && result.isError === true
|
|
1443
|
-
});
|
|
1444
|
-
});
|
|
1445
|
-
} else if (nativeDisabledExplicit) withTelegramApiErrorLogging({
|
|
1446
|
-
operation: "setMyCommands",
|
|
1447
|
-
runtime,
|
|
1448
|
-
fn: () => bot.api.setMyCommands([])
|
|
1449
|
-
}).catch(() => {});
|
|
1450
|
-
};
|
|
1451
|
-
//#endregion
|
|
1452
|
-
//#region extensions/telegram/src/bot-updates.ts
|
|
1453
|
-
const RECENT_TELEGRAM_UPDATE_TTL_MS = 5 * 6e4;
|
|
1454
|
-
const RECENT_TELEGRAM_UPDATE_MAX = 2e3;
|
|
1455
|
-
const resolveTelegramUpdateId = (ctx) => ctx.update?.update_id ?? ctx.update_id;
|
|
1456
|
-
const buildTelegramUpdateKey = (ctx) => {
|
|
1457
|
-
const updateId = resolveTelegramUpdateId(ctx);
|
|
1458
|
-
if (typeof updateId === "number") return `update:${updateId}`;
|
|
1459
|
-
const callbackId = ctx.callbackQuery?.id;
|
|
1460
|
-
if (callbackId) return `callback:${callbackId}`;
|
|
1461
|
-
const msg = ctx.message ?? ctx.channelPost ?? ctx.editedChannelPost ?? ctx.update?.message ?? ctx.update?.edited_message ?? ctx.update?.channel_post ?? ctx.update?.edited_channel_post ?? ctx.callbackQuery?.message;
|
|
1462
|
-
const chatId = msg?.chat?.id;
|
|
1463
|
-
const messageId = msg?.message_id;
|
|
1464
|
-
if (typeof chatId !== "undefined" && typeof messageId === "number") return `message:${chatId}:${messageId}`;
|
|
1465
|
-
};
|
|
1466
|
-
const createTelegramUpdateDedupe = () => createDedupeCache({
|
|
1467
|
-
ttlMs: RECENT_TELEGRAM_UPDATE_TTL_MS,
|
|
1468
|
-
maxSize: RECENT_TELEGRAM_UPDATE_MAX
|
|
1469
|
-
});
|
|
1470
|
-
//#endregion
|
|
1471
|
-
//#region extensions/telegram/src/group-migration.ts
|
|
1472
|
-
function resolveAccountGroups(cfg, accountId) {
|
|
1473
|
-
if (!accountId) return {};
|
|
1474
|
-
const normalized = normalizeAccountId(accountId);
|
|
1475
|
-
const accounts = cfg.channels?.telegram?.accounts;
|
|
1476
|
-
if (!accounts || typeof accounts !== "object") return {};
|
|
1477
|
-
const exact = accounts[normalized];
|
|
1478
|
-
if (exact?.groups) return { groups: exact.groups };
|
|
1479
|
-
const matchKey = Object.keys(accounts).find((key) => key.toLowerCase() === normalized.toLowerCase());
|
|
1480
|
-
return { groups: matchKey ? accounts[matchKey]?.groups : void 0 };
|
|
1481
|
-
}
|
|
1482
|
-
function migrateTelegramGroupsInPlace(groups, oldChatId, newChatId) {
|
|
1483
|
-
if (!groups) return {
|
|
1484
|
-
migrated: false,
|
|
1485
|
-
skippedExisting: false
|
|
1486
|
-
};
|
|
1487
|
-
if (oldChatId === newChatId) return {
|
|
1488
|
-
migrated: false,
|
|
1489
|
-
skippedExisting: false
|
|
1490
|
-
};
|
|
1491
|
-
if (!Object.hasOwn(groups, oldChatId)) return {
|
|
1492
|
-
migrated: false,
|
|
1493
|
-
skippedExisting: false
|
|
1494
|
-
};
|
|
1495
|
-
if (Object.hasOwn(groups, newChatId)) return {
|
|
1496
|
-
migrated: false,
|
|
1497
|
-
skippedExisting: true
|
|
1498
|
-
};
|
|
1499
|
-
groups[newChatId] = groups[oldChatId];
|
|
1500
|
-
delete groups[oldChatId];
|
|
1501
|
-
return {
|
|
1502
|
-
migrated: true,
|
|
1503
|
-
skippedExisting: false
|
|
1504
|
-
};
|
|
1505
|
-
}
|
|
1506
|
-
function migrateTelegramGroupConfig(params) {
|
|
1507
|
-
const scopes = [];
|
|
1508
|
-
let migrated = false;
|
|
1509
|
-
let skippedExisting = false;
|
|
1510
|
-
const migrationTargets = [{
|
|
1511
|
-
scope: "account",
|
|
1512
|
-
groups: resolveAccountGroups(params.cfg, params.accountId).groups
|
|
1513
|
-
}, {
|
|
1514
|
-
scope: "global",
|
|
1515
|
-
groups: params.cfg.channels?.telegram?.groups
|
|
1516
|
-
}];
|
|
1517
|
-
for (const target of migrationTargets) {
|
|
1518
|
-
const result = migrateTelegramGroupsInPlace(target.groups, params.oldChatId, params.newChatId);
|
|
1519
|
-
if (result.migrated) {
|
|
1520
|
-
migrated = true;
|
|
1521
|
-
scopes.push(target.scope);
|
|
1522
|
-
}
|
|
1523
|
-
if (result.skippedExisting) skippedExisting = true;
|
|
1524
|
-
}
|
|
1525
|
-
return {
|
|
1526
|
-
migrated,
|
|
1527
|
-
skippedExisting,
|
|
1528
|
-
scopes
|
|
1529
|
-
};
|
|
1530
|
-
}
|
|
1531
|
-
//#endregion
|
|
1532
|
-
//#region extensions/telegram/src/bot-handlers.runtime.ts
|
|
1533
|
-
const registerTelegramHandlers = ({ cfg, accountId, bot, opts, telegramTransport, runtime, mediaMaxBytes, telegramCfg, allowFrom, groupAllowFrom, resolveGroupPolicy, resolveTelegramGroupConfig, shouldSkipUpdate, processMessage, logger, telegramDeps = defaultTelegramBotDeps }) => {
|
|
1534
|
-
const DEFAULT_TEXT_FRAGMENT_MAX_GAP_MS = 1500;
|
|
1535
|
-
const TELEGRAM_TEXT_FRAGMENT_START_THRESHOLD_CHARS = 4e3;
|
|
1536
|
-
const TELEGRAM_TEXT_FRAGMENT_MAX_GAP_MS = typeof opts.testTimings?.textFragmentGapMs === "number" && Number.isFinite(opts.testTimings.textFragmentGapMs) ? Math.max(10, Math.floor(opts.testTimings.textFragmentGapMs)) : DEFAULT_TEXT_FRAGMENT_MAX_GAP_MS;
|
|
1537
|
-
const TELEGRAM_TEXT_FRAGMENT_MAX_ID_GAP = 1;
|
|
1538
|
-
const TELEGRAM_TEXT_FRAGMENT_MAX_PARTS = 12;
|
|
1539
|
-
const TELEGRAM_TEXT_FRAGMENT_MAX_TOTAL_CHARS = 5e4;
|
|
1540
|
-
const mediaGroupTimeoutMs = typeof opts.testTimings?.mediaGroupFlushMs === "number" && Number.isFinite(opts.testTimings.mediaGroupFlushMs) ? Math.max(10, Math.floor(opts.testTimings.mediaGroupFlushMs)) : 500;
|
|
1541
|
-
const mediaGroupBuffer = /* @__PURE__ */ new Map();
|
|
1542
|
-
let mediaGroupProcessing = Promise.resolve();
|
|
1543
|
-
const textFragmentBuffer = /* @__PURE__ */ new Map();
|
|
1544
|
-
let textFragmentProcessing = Promise.resolve();
|
|
1545
|
-
const debounceMs = resolveInboundDebounceMs({
|
|
1546
|
-
cfg,
|
|
1547
|
-
channel: "telegram"
|
|
1548
|
-
});
|
|
1549
|
-
const FORWARD_BURST_DEBOUNCE_MS = 80;
|
|
1550
|
-
const resolveTelegramDebounceLane = (msg) => {
|
|
1551
|
-
const forwardMeta = msg;
|
|
1552
|
-
return forwardMeta.forward_origin ?? forwardMeta.forward_from ?? forwardMeta.forward_from_chat ?? forwardMeta.forward_sender_name ?? forwardMeta.forward_date ? "forward" : "default";
|
|
1553
|
-
};
|
|
1554
|
-
const buildSyntheticTextMessage = (params) => ({
|
|
1555
|
-
...params.base,
|
|
1556
|
-
...params.from ? { from: params.from } : {},
|
|
1557
|
-
text: params.text,
|
|
1558
|
-
caption: void 0,
|
|
1559
|
-
caption_entities: void 0,
|
|
1560
|
-
entities: void 0,
|
|
1561
|
-
...params.date != null ? { date: params.date } : {}
|
|
1562
|
-
});
|
|
1563
|
-
const buildSyntheticContext = (ctx, message) => {
|
|
1564
|
-
const getFile = typeof ctx.getFile === "function" ? ctx.getFile.bind(ctx) : async () => ({});
|
|
1565
|
-
return {
|
|
1566
|
-
message,
|
|
1567
|
-
me: ctx.me,
|
|
1568
|
-
getFile
|
|
1569
|
-
};
|
|
1570
|
-
};
|
|
1571
|
-
const inboundDebouncer = createInboundDebouncer({
|
|
1572
|
-
debounceMs,
|
|
1573
|
-
resolveDebounceMs: (entry) => entry.debounceLane === "forward" ? FORWARD_BURST_DEBOUNCE_MS : debounceMs,
|
|
1574
|
-
buildKey: (entry) => entry.debounceKey,
|
|
1575
|
-
shouldDebounce: (entry) => {
|
|
1576
|
-
const hasDebounceableText = shouldDebounceTextInbound({
|
|
1577
|
-
text: entry.msg.text ?? entry.msg.caption ?? "",
|
|
1578
|
-
cfg,
|
|
1579
|
-
commandOptions: { botUsername: entry.botUsername }
|
|
1580
|
-
});
|
|
1581
|
-
if (entry.debounceLane === "forward") return hasDebounceableText || entry.allMedia.length > 0;
|
|
1582
|
-
if (!hasDebounceableText) return false;
|
|
1583
|
-
return entry.allMedia.length === 0;
|
|
1584
|
-
},
|
|
1585
|
-
onFlush: async (entries) => {
|
|
1586
|
-
const last = entries.at(-1);
|
|
1587
|
-
if (!last) return;
|
|
1588
|
-
if (entries.length === 1) {
|
|
1589
|
-
const replyMedia = await resolveReplyMediaForMessage(last.ctx, last.msg);
|
|
1590
|
-
await processMessage(last.ctx, last.allMedia, last.storeAllowFrom, {
|
|
1591
|
-
receivedAtMs: last.receivedAtMs,
|
|
1592
|
-
ingressBuffer: "inbound-debounce"
|
|
1593
|
-
}, replyMedia);
|
|
1594
|
-
return;
|
|
1595
|
-
}
|
|
1596
|
-
const combinedText = entries.map((entry) => entry.msg.text ?? entry.msg.caption ?? "").filter(Boolean).join("\n");
|
|
1597
|
-
const combinedMedia = entries.flatMap((entry) => entry.allMedia);
|
|
1598
|
-
if (!combinedText.trim() && combinedMedia.length === 0) return;
|
|
1599
|
-
const first = entries[0];
|
|
1600
|
-
const baseCtx = first.ctx;
|
|
1601
|
-
const syntheticMessage = buildSyntheticTextMessage({
|
|
1602
|
-
base: first.msg,
|
|
1603
|
-
text: combinedText,
|
|
1604
|
-
date: last.msg.date ?? first.msg.date
|
|
1605
|
-
});
|
|
1606
|
-
const messageIdOverride = last.msg.message_id ? String(last.msg.message_id) : void 0;
|
|
1607
|
-
const syntheticCtx = buildSyntheticContext(baseCtx, syntheticMessage);
|
|
1608
|
-
const replyMedia = await resolveReplyMediaForMessage(baseCtx, syntheticMessage);
|
|
1609
|
-
await processMessage(syntheticCtx, combinedMedia, first.storeAllowFrom, {
|
|
1610
|
-
...messageIdOverride ? { messageIdOverride } : {},
|
|
1611
|
-
receivedAtMs: first.receivedAtMs,
|
|
1612
|
-
ingressBuffer: "inbound-debounce"
|
|
1613
|
-
}, replyMedia);
|
|
1614
|
-
},
|
|
1615
|
-
onError: (err, items) => {
|
|
1616
|
-
runtime.error?.(danger(`telegram debounce flush failed: ${String(err)}`));
|
|
1617
|
-
const chatId = items[0]?.msg.chat.id;
|
|
1618
|
-
if (chatId != null) {
|
|
1619
|
-
const threadId = items[0]?.msg.message_thread_id;
|
|
1620
|
-
bot.api.sendMessage(chatId, "Something went wrong while processing your message. Please try again.", threadId != null ? { message_thread_id: threadId } : void 0).catch((sendErr) => {
|
|
1621
|
-
logVerbose(`telegram: error fallback send failed: ${String(sendErr)}`);
|
|
1622
|
-
});
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
|
-
});
|
|
1626
|
-
const resolveTelegramSessionState = (params) => {
|
|
1627
|
-
const runtimeCfg = telegramDeps.loadConfig();
|
|
1628
|
-
const resolvedThreadId = params.resolvedThreadId ?? resolveTelegramForumThreadId({
|
|
1629
|
-
isForum: params.isForum,
|
|
1630
|
-
messageThreadId: params.messageThreadId
|
|
1631
|
-
});
|
|
1632
|
-
const dmThreadId = !params.isGroup ? params.messageThreadId : void 0;
|
|
1633
|
-
const topicThreadId = resolvedThreadId ?? dmThreadId;
|
|
1634
|
-
const { topicConfig } = resolveTelegramGroupConfig(params.chatId, topicThreadId);
|
|
1635
|
-
const { route } = resolveTelegramConversationRoute({
|
|
1636
|
-
cfg: runtimeCfg,
|
|
1637
|
-
accountId,
|
|
1638
|
-
chatId: params.chatId,
|
|
1639
|
-
isGroup: params.isGroup,
|
|
1640
|
-
resolvedThreadId,
|
|
1641
|
-
replyThreadId: topicThreadId,
|
|
1642
|
-
senderId: params.senderId,
|
|
1643
|
-
topicAgentId: topicConfig?.agentId
|
|
1644
|
-
});
|
|
1645
|
-
const baseSessionKey = resolveTelegramConversationBaseSessionKey({
|
|
1646
|
-
cfg: runtimeCfg,
|
|
1647
|
-
route,
|
|
1648
|
-
chatId: params.chatId,
|
|
1649
|
-
isGroup: params.isGroup,
|
|
1650
|
-
senderId: params.senderId
|
|
1651
|
-
});
|
|
1652
|
-
const sessionKey = (dmThreadId != null ? resolveThreadSessionKeys({
|
|
1653
|
-
baseSessionKey,
|
|
1654
|
-
threadId: `${params.chatId}:${dmThreadId}`
|
|
1655
|
-
}) : null)?.sessionKey ?? baseSessionKey;
|
|
1656
|
-
const store = loadSessionStore(telegramDeps.resolveStorePath(runtimeCfg.session?.store, { agentId: route.agentId }));
|
|
1657
|
-
const entry = resolveSessionStoreEntry({
|
|
1658
|
-
store,
|
|
1659
|
-
sessionKey
|
|
1660
|
-
}).existing;
|
|
1661
|
-
const storedOverride = resolveStoredModelOverride({
|
|
1662
|
-
sessionEntry: entry,
|
|
1663
|
-
sessionStore: store,
|
|
1664
|
-
sessionKey
|
|
1665
|
-
});
|
|
1666
|
-
if (storedOverride) return {
|
|
1667
|
-
agentId: route.agentId,
|
|
1668
|
-
sessionEntry: entry,
|
|
1669
|
-
sessionKey,
|
|
1670
|
-
model: storedOverride.provider ? `${storedOverride.provider}/${storedOverride.model}` : storedOverride.model
|
|
1671
|
-
};
|
|
1672
|
-
const provider = entry?.modelProvider?.trim();
|
|
1673
|
-
const model = entry?.model?.trim();
|
|
1674
|
-
if (provider && model) return {
|
|
1675
|
-
agentId: route.agentId,
|
|
1676
|
-
sessionEntry: entry,
|
|
1677
|
-
sessionKey,
|
|
1678
|
-
model: `${provider}/${model}`
|
|
1679
|
-
};
|
|
1680
|
-
const modelCfg = runtimeCfg.agents?.defaults?.model;
|
|
1681
|
-
return {
|
|
1682
|
-
agentId: route.agentId,
|
|
1683
|
-
sessionEntry: entry,
|
|
1684
|
-
sessionKey,
|
|
1685
|
-
model: typeof modelCfg === "string" ? modelCfg : modelCfg?.primary
|
|
1686
|
-
};
|
|
1687
|
-
};
|
|
1688
|
-
const processMediaGroup = async (entry) => {
|
|
1689
|
-
try {
|
|
1690
|
-
entry.messages.sort((a, b) => a.msg.message_id - b.msg.message_id);
|
|
1691
|
-
const primaryEntry = entry.messages.find((m) => m.msg.caption || m.msg.text) ?? entry.messages[0];
|
|
1692
|
-
const allMedia = [];
|
|
1693
|
-
for (const { ctx } of entry.messages) {
|
|
1694
|
-
let media;
|
|
1695
|
-
try {
|
|
1696
|
-
media = await resolveMedia(ctx, mediaMaxBytes, opts.token, telegramTransport, telegramCfg.apiRoot);
|
|
1697
|
-
} catch (mediaErr) {
|
|
1698
|
-
if (!isRecoverableMediaGroupError(mediaErr)) throw mediaErr;
|
|
1699
|
-
runtime.log?.(warn(`media group: skipping photo that failed to fetch: ${String(mediaErr)}`));
|
|
1700
|
-
continue;
|
|
1701
|
-
}
|
|
1702
|
-
if (media) allMedia.push({
|
|
1703
|
-
path: media.path,
|
|
1704
|
-
contentType: media.contentType,
|
|
1705
|
-
stickerMetadata: media.stickerMetadata
|
|
1706
|
-
});
|
|
1707
|
-
}
|
|
1708
|
-
const storeAllowFrom = await loadStoreAllowFrom();
|
|
1709
|
-
const replyMedia = await resolveReplyMediaForMessage(primaryEntry.ctx, primaryEntry.msg);
|
|
1710
|
-
await processMessage(primaryEntry.ctx, allMedia, storeAllowFrom, void 0, replyMedia);
|
|
1711
|
-
} catch (err) {
|
|
1712
|
-
runtime.error?.(danger(`media group handler failed: ${String(err)}`));
|
|
1713
|
-
}
|
|
1714
|
-
};
|
|
1715
|
-
const flushTextFragments = async (entry) => {
|
|
1716
|
-
try {
|
|
1717
|
-
entry.messages.sort((a, b) => a.msg.message_id - b.msg.message_id);
|
|
1718
|
-
const first = entry.messages[0];
|
|
1719
|
-
const last = entry.messages.at(-1);
|
|
1720
|
-
if (!first || !last) return;
|
|
1721
|
-
const combinedText = entry.messages.map((m) => m.msg.text ?? "").join("");
|
|
1722
|
-
if (!combinedText.trim()) return;
|
|
1723
|
-
const syntheticMessage = buildSyntheticTextMessage({
|
|
1724
|
-
base: first.msg,
|
|
1725
|
-
text: combinedText,
|
|
1726
|
-
date: last.msg.date ?? first.msg.date
|
|
1727
|
-
});
|
|
1728
|
-
const storeAllowFrom = await loadStoreAllowFrom();
|
|
1729
|
-
const baseCtx = first.ctx;
|
|
1730
|
-
await processMessage(buildSyntheticContext(baseCtx, syntheticMessage), [], storeAllowFrom, {
|
|
1731
|
-
messageIdOverride: String(last.msg.message_id),
|
|
1732
|
-
receivedAtMs: first.receivedAtMs,
|
|
1733
|
-
ingressBuffer: "text-fragment"
|
|
1734
|
-
});
|
|
1735
|
-
} catch (err) {
|
|
1736
|
-
runtime.error?.(danger(`text fragment handler failed: ${String(err)}`));
|
|
1737
|
-
}
|
|
1738
|
-
};
|
|
1739
|
-
const queueTextFragmentFlush = async (entry) => {
|
|
1740
|
-
textFragmentProcessing = textFragmentProcessing.then(async () => {
|
|
1741
|
-
await flushTextFragments(entry);
|
|
1742
|
-
}).catch(() => void 0);
|
|
1743
|
-
await textFragmentProcessing;
|
|
1744
|
-
};
|
|
1745
|
-
const runTextFragmentFlush = async (entry) => {
|
|
1746
|
-
textFragmentBuffer.delete(entry.key);
|
|
1747
|
-
await queueTextFragmentFlush(entry);
|
|
1748
|
-
};
|
|
1749
|
-
const scheduleTextFragmentFlush = (entry) => {
|
|
1750
|
-
clearTimeout(entry.timer);
|
|
1751
|
-
entry.timer = setTimeout(async () => {
|
|
1752
|
-
await runTextFragmentFlush(entry);
|
|
1753
|
-
}, TELEGRAM_TEXT_FRAGMENT_MAX_GAP_MS);
|
|
1754
|
-
};
|
|
1755
|
-
const loadStoreAllowFrom = async () => telegramDeps.readChannelAllowFromStore("telegram", process.env, accountId).catch(() => []);
|
|
1756
|
-
const resolveReplyMediaForMessage = async (ctx, msg) => {
|
|
1757
|
-
const replyMessage = msg.reply_to_message;
|
|
1758
|
-
if (!replyMessage || !hasInboundMedia(replyMessage)) return [];
|
|
1759
|
-
const replyFileId = resolveInboundMediaFileId(replyMessage);
|
|
1760
|
-
if (!replyFileId) return [];
|
|
1761
|
-
try {
|
|
1762
|
-
const media = await resolveMedia({
|
|
1763
|
-
message: replyMessage,
|
|
1764
|
-
me: ctx.me,
|
|
1765
|
-
getFile: async () => await bot.api.getFile(replyFileId)
|
|
1766
|
-
}, mediaMaxBytes, opts.token, telegramTransport, telegramCfg.apiRoot);
|
|
1767
|
-
if (!media) return [];
|
|
1768
|
-
return [{
|
|
1769
|
-
path: media.path,
|
|
1770
|
-
contentType: media.contentType,
|
|
1771
|
-
stickerMetadata: media.stickerMetadata
|
|
1772
|
-
}];
|
|
1773
|
-
} catch (err) {
|
|
1774
|
-
logger.warn({
|
|
1775
|
-
chatId: msg.chat.id,
|
|
1776
|
-
error: String(err)
|
|
1777
|
-
}, "reply media fetch failed");
|
|
1778
|
-
return [];
|
|
1779
|
-
}
|
|
1780
|
-
};
|
|
1781
|
-
const isAllowlistAuthorized = (allow, senderId, senderUsername) => allow.hasWildcard || allow.hasEntries && isSenderAllowed({
|
|
1782
|
-
allow,
|
|
1783
|
-
senderId,
|
|
1784
|
-
senderUsername
|
|
1785
|
-
});
|
|
1786
|
-
const shouldSkipGroupMessage = (params) => {
|
|
1787
|
-
const { isGroup, chatId, chatTitle, resolvedThreadId, senderId, senderUsername, effectiveGroupAllow, hasGroupAllowOverride, groupConfig, topicConfig } = params;
|
|
1788
|
-
const baseAccess = evaluateTelegramGroupBaseAccess({
|
|
1789
|
-
isGroup,
|
|
1790
|
-
groupConfig,
|
|
1791
|
-
topicConfig,
|
|
1792
|
-
hasGroupAllowOverride,
|
|
1793
|
-
effectiveGroupAllow,
|
|
1794
|
-
senderId,
|
|
1795
|
-
senderUsername,
|
|
1796
|
-
enforceAllowOverride: true,
|
|
1797
|
-
requireSenderForAllowOverride: true
|
|
1798
|
-
});
|
|
1799
|
-
if (!baseAccess.allowed) {
|
|
1800
|
-
if (baseAccess.reason === "group-disabled") {
|
|
1801
|
-
logVerbose(`Blocked telegram group ${chatId} (group disabled)`);
|
|
1802
|
-
return true;
|
|
1803
|
-
}
|
|
1804
|
-
if (baseAccess.reason === "topic-disabled") {
|
|
1805
|
-
logVerbose(`Blocked telegram topic ${chatId} (${resolvedThreadId ?? "unknown"}) (topic disabled)`);
|
|
1806
|
-
return true;
|
|
1807
|
-
}
|
|
1808
|
-
logVerbose(`Blocked telegram group sender ${senderId || "unknown"} (group allowFrom override)`);
|
|
1809
|
-
return true;
|
|
1810
|
-
}
|
|
1811
|
-
if (!isGroup) return false;
|
|
1812
|
-
const policyAccess = evaluateTelegramGroupPolicyAccess({
|
|
1813
|
-
isGroup,
|
|
1814
|
-
chatId,
|
|
1815
|
-
cfg,
|
|
1816
|
-
telegramCfg,
|
|
1817
|
-
topicConfig,
|
|
1818
|
-
groupConfig,
|
|
1819
|
-
effectiveGroupAllow,
|
|
1820
|
-
senderId,
|
|
1821
|
-
senderUsername,
|
|
1822
|
-
resolveGroupPolicy,
|
|
1823
|
-
enforcePolicy: true,
|
|
1824
|
-
useTopicAndGroupOverrides: true,
|
|
1825
|
-
enforceAllowlistAuthorization: true,
|
|
1826
|
-
allowEmptyAllowlistEntries: false,
|
|
1827
|
-
requireSenderForAllowlistAuthorization: true,
|
|
1828
|
-
checkChatAllowlist: true
|
|
1829
|
-
});
|
|
1830
|
-
if (!policyAccess.allowed) {
|
|
1831
|
-
if (policyAccess.reason === "group-policy-disabled") {
|
|
1832
|
-
logVerbose("Blocked telegram group message (groupPolicy: disabled)");
|
|
1833
|
-
return true;
|
|
1834
|
-
}
|
|
1835
|
-
if (policyAccess.reason === "group-policy-allowlist-no-sender") {
|
|
1836
|
-
logVerbose("Blocked telegram group message (no sender ID, groupPolicy: allowlist)");
|
|
1837
|
-
return true;
|
|
1838
|
-
}
|
|
1839
|
-
if (policyAccess.reason === "group-policy-allowlist-empty") {
|
|
1840
|
-
logVerbose("Blocked telegram group message (groupPolicy: allowlist, no group allowlist entries)");
|
|
1841
|
-
return true;
|
|
1842
|
-
}
|
|
1843
|
-
if (policyAccess.reason === "group-policy-allowlist-unauthorized") {
|
|
1844
|
-
logVerbose(`Blocked telegram group message from ${senderId} (groupPolicy: allowlist)`);
|
|
1845
|
-
return true;
|
|
1846
|
-
}
|
|
1847
|
-
logger.info({
|
|
1848
|
-
chatId,
|
|
1849
|
-
title: chatTitle,
|
|
1850
|
-
reason: "not-allowed"
|
|
1851
|
-
}, "skipping group message");
|
|
1852
|
-
return true;
|
|
1853
|
-
}
|
|
1854
|
-
return false;
|
|
1855
|
-
};
|
|
1856
|
-
const getChat = typeof bot.api.getChat === "function" ? bot.api.getChat.bind(bot.api) : void 0;
|
|
1857
|
-
const TELEGRAM_EVENT_AUTH_RULES = {
|
|
1858
|
-
reaction: {
|
|
1859
|
-
enforceDirectAuthorization: true,
|
|
1860
|
-
enforceGroupAllowlistAuthorization: false,
|
|
1861
|
-
deniedDmReason: "reaction unauthorized by dm policy/allowlist",
|
|
1862
|
-
deniedGroupReason: "reaction unauthorized by group allowlist"
|
|
1863
|
-
},
|
|
1864
|
-
"callback-scope": {
|
|
1865
|
-
enforceDirectAuthorization: false,
|
|
1866
|
-
enforceGroupAllowlistAuthorization: false,
|
|
1867
|
-
deniedDmReason: "callback unauthorized by inlineButtonsScope",
|
|
1868
|
-
deniedGroupReason: "callback unauthorized by inlineButtonsScope"
|
|
1869
|
-
},
|
|
1870
|
-
"callback-allowlist": {
|
|
1871
|
-
enforceDirectAuthorization: true,
|
|
1872
|
-
enforceGroupAllowlistAuthorization: false,
|
|
1873
|
-
deniedDmReason: "callback unauthorized by inlineButtonsScope allowlist",
|
|
1874
|
-
deniedGroupReason: "callback unauthorized by inlineButtonsScope allowlist"
|
|
1875
|
-
}
|
|
1876
|
-
};
|
|
1877
|
-
const resolveTelegramEventAuthorizationContext = async (params) => {
|
|
1878
|
-
const groupAllowContext = params.groupAllowContext ?? await resolveTelegramGroupAllowFromContext({
|
|
1879
|
-
chatId: params.chatId,
|
|
1880
|
-
accountId,
|
|
1881
|
-
isGroup: params.isGroup,
|
|
1882
|
-
isForum: params.isForum,
|
|
1883
|
-
messageThreadId: params.messageThreadId,
|
|
1884
|
-
groupAllowFrom,
|
|
1885
|
-
readChannelAllowFromStore: telegramDeps.readChannelAllowFromStore,
|
|
1886
|
-
resolveTelegramGroupConfig
|
|
1887
|
-
});
|
|
1888
|
-
return {
|
|
1889
|
-
dmPolicy: !params.isGroup && groupAllowContext.groupConfig && "dmPolicy" in groupAllowContext.groupConfig ? groupAllowContext.groupConfig.dmPolicy ?? telegramCfg.dmPolicy ?? "pairing" : telegramCfg.dmPolicy ?? "pairing",
|
|
1890
|
-
...groupAllowContext
|
|
1891
|
-
};
|
|
1892
|
-
};
|
|
1893
|
-
const authorizeTelegramEventSender = (params) => {
|
|
1894
|
-
const { chatId, chatTitle, isGroup, senderId, senderUsername, mode, context } = params;
|
|
1895
|
-
const { dmPolicy, resolvedThreadId, storeAllowFrom, groupConfig, topicConfig, groupAllowOverride, effectiveGroupAllow, hasGroupAllowOverride } = context;
|
|
1896
|
-
const { enforceDirectAuthorization, enforceGroupAllowlistAuthorization, deniedDmReason, deniedGroupReason } = TELEGRAM_EVENT_AUTH_RULES[mode];
|
|
1897
|
-
if (shouldSkipGroupMessage({
|
|
1898
|
-
isGroup,
|
|
1899
|
-
chatId,
|
|
1900
|
-
chatTitle,
|
|
1901
|
-
resolvedThreadId,
|
|
1902
|
-
senderId,
|
|
1903
|
-
senderUsername,
|
|
1904
|
-
effectiveGroupAllow,
|
|
1905
|
-
hasGroupAllowOverride,
|
|
1906
|
-
groupConfig,
|
|
1907
|
-
topicConfig
|
|
1908
|
-
})) return {
|
|
1909
|
-
allowed: false,
|
|
1910
|
-
reason: "group-policy"
|
|
1911
|
-
};
|
|
1912
|
-
if (!isGroup && enforceDirectAuthorization) {
|
|
1913
|
-
if (dmPolicy === "disabled") {
|
|
1914
|
-
logVerbose(`Blocked telegram direct event from ${senderId || "unknown"} (${deniedDmReason})`);
|
|
1915
|
-
return {
|
|
1916
|
-
allowed: false,
|
|
1917
|
-
reason: "direct-disabled"
|
|
1918
|
-
};
|
|
1919
|
-
}
|
|
1920
|
-
if (dmPolicy !== "open") {
|
|
1921
|
-
if (!isAllowlistAuthorized(normalizeDmAllowFromWithStore({
|
|
1922
|
-
allowFrom: groupAllowOverride ?? allowFrom,
|
|
1923
|
-
storeAllowFrom,
|
|
1924
|
-
dmPolicy
|
|
1925
|
-
}), senderId, senderUsername)) {
|
|
1926
|
-
logVerbose(`Blocked telegram direct sender ${senderId || "unknown"} (${deniedDmReason})`);
|
|
1927
|
-
return {
|
|
1928
|
-
allowed: false,
|
|
1929
|
-
reason: "direct-unauthorized"
|
|
1930
|
-
};
|
|
1931
|
-
}
|
|
1932
|
-
}
|
|
1933
|
-
}
|
|
1934
|
-
if (isGroup && enforceGroupAllowlistAuthorization) {
|
|
1935
|
-
if (!isAllowlistAuthorized(effectiveGroupAllow, senderId, senderUsername)) {
|
|
1936
|
-
logVerbose(`Blocked telegram group sender ${senderId || "unknown"} (${deniedGroupReason})`);
|
|
1937
|
-
return {
|
|
1938
|
-
allowed: false,
|
|
1939
|
-
reason: "group-unauthorized"
|
|
1940
|
-
};
|
|
1941
|
-
}
|
|
1942
|
-
}
|
|
1943
|
-
return { allowed: true };
|
|
1944
|
-
};
|
|
1945
|
-
bot.on("message_reaction", async (ctx) => {
|
|
1946
|
-
try {
|
|
1947
|
-
const reaction = ctx.messageReaction;
|
|
1948
|
-
if (!reaction) return;
|
|
1949
|
-
if (shouldSkipUpdate(ctx)) return;
|
|
1950
|
-
const chatId = reaction.chat.id;
|
|
1951
|
-
const messageId = reaction.message_id;
|
|
1952
|
-
const user = reaction.user;
|
|
1953
|
-
const senderId = user?.id != null ? String(user.id) : "";
|
|
1954
|
-
const senderUsername = user?.username ?? "";
|
|
1955
|
-
const isGroup = reaction.chat.type === "group" || reaction.chat.type === "supergroup";
|
|
1956
|
-
const isForum = reaction.chat.is_forum === true;
|
|
1957
|
-
const reactionMode = telegramCfg.reactionNotifications ?? "own";
|
|
1958
|
-
if (reactionMode === "off") return;
|
|
1959
|
-
if (user?.is_bot) return;
|
|
1960
|
-
if (reactionMode === "own" && !telegramDeps.wasSentByBot(chatId, messageId)) {
|
|
1961
|
-
logVerbose(`telegram: skipped reaction on msg ${messageId} in chat ${chatId} (own mode, not sent by bot)`);
|
|
1962
|
-
return;
|
|
1963
|
-
}
|
|
1964
|
-
const eventAuthContext = await resolveTelegramEventAuthorizationContext({
|
|
1965
|
-
chatId,
|
|
1966
|
-
isGroup,
|
|
1967
|
-
isForum
|
|
1968
|
-
});
|
|
1969
|
-
if (!authorizeTelegramEventSender({
|
|
1970
|
-
chatId,
|
|
1971
|
-
chatTitle: reaction.chat.title,
|
|
1972
|
-
isGroup,
|
|
1973
|
-
senderId,
|
|
1974
|
-
senderUsername,
|
|
1975
|
-
mode: "reaction",
|
|
1976
|
-
context: eventAuthContext
|
|
1977
|
-
}).allowed) return;
|
|
1978
|
-
if (!isGroup) {
|
|
1979
|
-
if (eventAuthContext.groupConfig?.requireTopic === true) {
|
|
1980
|
-
logVerbose(`Blocked telegram reaction in DM ${chatId}: requireTopic=true but topic unknown for reactions`);
|
|
1981
|
-
return;
|
|
1982
|
-
}
|
|
1983
|
-
}
|
|
1984
|
-
const oldEmojis = new Set(reaction.old_reaction.filter((r) => r.type === "emoji").map((r) => r.emoji));
|
|
1985
|
-
const addedReactions = reaction.new_reaction.filter((r) => r.type === "emoji").filter((r) => !oldEmojis.has(r.emoji));
|
|
1986
|
-
if (addedReactions.length === 0) return;
|
|
1987
|
-
const senderName = user ? [user.first_name, user.last_name].filter(Boolean).join(" ").trim() || user.username : void 0;
|
|
1988
|
-
const senderUsernameLabel = user?.username ? `@${user.username}` : void 0;
|
|
1989
|
-
let senderLabel = senderName;
|
|
1990
|
-
if (senderName && senderUsernameLabel) senderLabel = `${senderName} (${senderUsernameLabel})`;
|
|
1991
|
-
else if (!senderName && senderUsernameLabel) senderLabel = senderUsernameLabel;
|
|
1992
|
-
if (!senderLabel && user?.id) senderLabel = `id:${user.id}`;
|
|
1993
|
-
senderLabel = senderLabel || "unknown";
|
|
1994
|
-
const resolvedThreadId = isForum ? resolveTelegramForumThreadId({
|
|
1995
|
-
isForum,
|
|
1996
|
-
messageThreadId: void 0
|
|
1997
|
-
}) : void 0;
|
|
1998
|
-
const peerId = isGroup ? buildTelegramGroupPeerId(chatId, resolvedThreadId) : String(chatId);
|
|
1999
|
-
const parentPeer = buildTelegramParentPeer({
|
|
2000
|
-
isGroup,
|
|
2001
|
-
resolvedThreadId,
|
|
2002
|
-
chatId
|
|
2003
|
-
});
|
|
2004
|
-
const sessionKey = resolveAgentRoute({
|
|
2005
|
-
cfg: telegramDeps.loadConfig(),
|
|
2006
|
-
channel: "telegram",
|
|
2007
|
-
accountId,
|
|
2008
|
-
peer: {
|
|
2009
|
-
kind: isGroup ? "group" : "direct",
|
|
2010
|
-
id: peerId
|
|
2011
|
-
},
|
|
2012
|
-
parentPeer
|
|
2013
|
-
}).sessionKey;
|
|
2014
|
-
for (const r of addedReactions) {
|
|
2015
|
-
const emoji = r.emoji;
|
|
2016
|
-
const text = `Telegram reaction added: ${emoji} by ${senderLabel} on msg ${messageId}`;
|
|
2017
|
-
telegramDeps.enqueueSystemEvent(text, {
|
|
2018
|
-
sessionKey,
|
|
2019
|
-
contextKey: `telegram:reaction:add:${chatId}:${messageId}:${user?.id ?? "anon"}:${emoji}`
|
|
2020
|
-
});
|
|
2021
|
-
logVerbose(`telegram: reaction event enqueued: ${text}`);
|
|
2022
|
-
}
|
|
2023
|
-
} catch (err) {
|
|
2024
|
-
runtime.error?.(danger(`telegram reaction handler failed: ${String(err)}`));
|
|
2025
|
-
}
|
|
2026
|
-
});
|
|
2027
|
-
const processInboundMessage = async (params) => {
|
|
2028
|
-
const { ctx, msg, chatId, resolvedThreadId, dmThreadId, storeAllowFrom, sendOversizeWarning, oversizeLogMessage } = params;
|
|
2029
|
-
const text = typeof msg.text === "string" ? msg.text : void 0;
|
|
2030
|
-
const isCommandLike = (text ?? "").trim().startsWith("/");
|
|
2031
|
-
if (text && !isCommandLike) {
|
|
2032
|
-
const nowMs = Date.now();
|
|
2033
|
-
const senderId = msg.from?.id != null ? String(msg.from.id) : "unknown";
|
|
2034
|
-
const key = `text:${chatId}:${resolvedThreadId ?? dmThreadId ?? "main"}:${senderId}`;
|
|
2035
|
-
const existing = textFragmentBuffer.get(key);
|
|
2036
|
-
if (existing) {
|
|
2037
|
-
const last = existing.messages.at(-1);
|
|
2038
|
-
const lastMsgId = last?.msg.message_id;
|
|
2039
|
-
const lastReceivedAtMs = last?.receivedAtMs ?? nowMs;
|
|
2040
|
-
const idGap = typeof lastMsgId === "number" ? msg.message_id - lastMsgId : Infinity;
|
|
2041
|
-
const timeGapMs = nowMs - lastReceivedAtMs;
|
|
2042
|
-
if (idGap > 0 && idGap <= TELEGRAM_TEXT_FRAGMENT_MAX_ID_GAP && timeGapMs >= 0 && timeGapMs <= TELEGRAM_TEXT_FRAGMENT_MAX_GAP_MS) {
|
|
2043
|
-
const nextTotalChars = existing.messages.reduce((sum, m) => sum + (m.msg.text?.length ?? 0), 0) + text.length;
|
|
2044
|
-
if (existing.messages.length + 1 <= TELEGRAM_TEXT_FRAGMENT_MAX_PARTS && nextTotalChars <= TELEGRAM_TEXT_FRAGMENT_MAX_TOTAL_CHARS) {
|
|
2045
|
-
existing.messages.push({
|
|
2046
|
-
msg,
|
|
2047
|
-
ctx,
|
|
2048
|
-
receivedAtMs: nowMs
|
|
2049
|
-
});
|
|
2050
|
-
scheduleTextFragmentFlush(existing);
|
|
2051
|
-
return;
|
|
2052
|
-
}
|
|
2053
|
-
}
|
|
2054
|
-
clearTimeout(existing.timer);
|
|
2055
|
-
textFragmentBuffer.delete(key);
|
|
2056
|
-
textFragmentProcessing = textFragmentProcessing.then(async () => {
|
|
2057
|
-
await flushTextFragments(existing);
|
|
2058
|
-
}).catch(() => void 0);
|
|
2059
|
-
await textFragmentProcessing;
|
|
2060
|
-
}
|
|
2061
|
-
if (text.length >= TELEGRAM_TEXT_FRAGMENT_START_THRESHOLD_CHARS) {
|
|
2062
|
-
const entry = {
|
|
2063
|
-
key,
|
|
2064
|
-
messages: [{
|
|
2065
|
-
msg,
|
|
2066
|
-
ctx,
|
|
2067
|
-
receivedAtMs: nowMs
|
|
2068
|
-
}],
|
|
2069
|
-
timer: setTimeout(() => {}, TELEGRAM_TEXT_FRAGMENT_MAX_GAP_MS)
|
|
2070
|
-
};
|
|
2071
|
-
textFragmentBuffer.set(key, entry);
|
|
2072
|
-
scheduleTextFragmentFlush(entry);
|
|
2073
|
-
return;
|
|
2074
|
-
}
|
|
2075
|
-
}
|
|
2076
|
-
const mediaGroupId = msg.media_group_id;
|
|
2077
|
-
if (mediaGroupId) {
|
|
2078
|
-
const existing = mediaGroupBuffer.get(mediaGroupId);
|
|
2079
|
-
if (existing) {
|
|
2080
|
-
clearTimeout(existing.timer);
|
|
2081
|
-
existing.messages.push({
|
|
2082
|
-
msg,
|
|
2083
|
-
ctx
|
|
2084
|
-
});
|
|
2085
|
-
existing.timer = setTimeout(async () => {
|
|
2086
|
-
mediaGroupBuffer.delete(mediaGroupId);
|
|
2087
|
-
mediaGroupProcessing = mediaGroupProcessing.then(async () => {
|
|
2088
|
-
await processMediaGroup(existing);
|
|
2089
|
-
}).catch(() => void 0);
|
|
2090
|
-
await mediaGroupProcessing;
|
|
2091
|
-
}, mediaGroupTimeoutMs);
|
|
2092
|
-
} else {
|
|
2093
|
-
const entry = {
|
|
2094
|
-
messages: [{
|
|
2095
|
-
msg,
|
|
2096
|
-
ctx
|
|
2097
|
-
}],
|
|
2098
|
-
timer: setTimeout(async () => {
|
|
2099
|
-
mediaGroupBuffer.delete(mediaGroupId);
|
|
2100
|
-
mediaGroupProcessing = mediaGroupProcessing.then(async () => {
|
|
2101
|
-
await processMediaGroup(entry);
|
|
2102
|
-
}).catch(() => void 0);
|
|
2103
|
-
await mediaGroupProcessing;
|
|
2104
|
-
}, mediaGroupTimeoutMs)
|
|
2105
|
-
};
|
|
2106
|
-
mediaGroupBuffer.set(mediaGroupId, entry);
|
|
2107
|
-
}
|
|
2108
|
-
return;
|
|
2109
|
-
}
|
|
2110
|
-
let media = null;
|
|
2111
|
-
try {
|
|
2112
|
-
media = await resolveMedia(ctx, mediaMaxBytes, opts.token, telegramTransport, telegramCfg.apiRoot);
|
|
2113
|
-
} catch (mediaErr) {
|
|
2114
|
-
if (isMediaSizeLimitError(mediaErr)) {
|
|
2115
|
-
if (sendOversizeWarning) {
|
|
2116
|
-
const limitMb = Math.round(mediaMaxBytes / (1024 * 1024));
|
|
2117
|
-
await withTelegramApiErrorLogging({
|
|
2118
|
-
operation: "sendMessage",
|
|
2119
|
-
runtime,
|
|
2120
|
-
fn: () => bot.api.sendMessage(chatId, `⚠️ File too large. Maximum size is ${limitMb}MB.`, { reply_parameters: {
|
|
2121
|
-
message_id: msg.message_id,
|
|
2122
|
-
allow_sending_without_reply: true
|
|
2123
|
-
} })
|
|
2124
|
-
}).catch(() => {});
|
|
2125
|
-
}
|
|
2126
|
-
logger.warn({
|
|
2127
|
-
chatId,
|
|
2128
|
-
error: String(mediaErr)
|
|
2129
|
-
}, oversizeLogMessage);
|
|
2130
|
-
return;
|
|
2131
|
-
}
|
|
2132
|
-
logger.warn({
|
|
2133
|
-
chatId,
|
|
2134
|
-
error: String(mediaErr)
|
|
2135
|
-
}, "media fetch failed");
|
|
2136
|
-
await withTelegramApiErrorLogging({
|
|
2137
|
-
operation: "sendMessage",
|
|
2138
|
-
runtime,
|
|
2139
|
-
fn: () => bot.api.sendMessage(chatId, "⚠️ Failed to download media. Please try again.", { reply_parameters: {
|
|
2140
|
-
message_id: msg.message_id,
|
|
2141
|
-
allow_sending_without_reply: true
|
|
2142
|
-
} })
|
|
2143
|
-
}).catch(() => {});
|
|
2144
|
-
return;
|
|
2145
|
-
}
|
|
2146
|
-
const hasText = Boolean(getTelegramTextParts(msg).text.trim());
|
|
2147
|
-
if (msg.sticker && !media && !hasText) {
|
|
2148
|
-
logVerbose("telegram: skipping sticker-only message (unsupported sticker type)");
|
|
2149
|
-
return;
|
|
2150
|
-
}
|
|
2151
|
-
const allMedia = media ? [{
|
|
2152
|
-
path: media.path,
|
|
2153
|
-
contentType: media.contentType,
|
|
2154
|
-
stickerMetadata: media.stickerMetadata
|
|
2155
|
-
}] : [];
|
|
2156
|
-
const senderId = msg.from?.id ? String(msg.from.id) : "";
|
|
2157
|
-
const conversationThreadId = resolvedThreadId ?? dmThreadId;
|
|
2158
|
-
const conversationKey = conversationThreadId != null ? `${chatId}:topic:${conversationThreadId}` : String(chatId);
|
|
2159
|
-
const debounceLane = resolveTelegramDebounceLane(msg);
|
|
2160
|
-
const debounceKey = senderId ? `telegram:${accountId ?? "default"}:${conversationKey}:${senderId}:${debounceLane}` : null;
|
|
2161
|
-
await inboundDebouncer.enqueue({
|
|
2162
|
-
ctx,
|
|
2163
|
-
msg,
|
|
2164
|
-
allMedia,
|
|
2165
|
-
storeAllowFrom,
|
|
2166
|
-
receivedAtMs: Date.now(),
|
|
2167
|
-
debounceKey,
|
|
2168
|
-
debounceLane,
|
|
2169
|
-
botUsername: ctx.me?.username
|
|
2170
|
-
});
|
|
2171
|
-
};
|
|
2172
|
-
bot.on("callback_query", async (ctx) => {
|
|
2173
|
-
const callback = ctx.callbackQuery;
|
|
2174
|
-
if (!callback) return;
|
|
2175
|
-
if (shouldSkipUpdate(ctx)) return;
|
|
2176
|
-
await withTelegramApiErrorLogging({
|
|
2177
|
-
operation: "answerCallbackQuery",
|
|
2178
|
-
runtime,
|
|
2179
|
-
fn: typeof ctx.answerCallbackQuery === "function" ? () => ctx.answerCallbackQuery() : () => bot.api.answerCallbackQuery(callback.id)
|
|
2180
|
-
}).catch(() => {});
|
|
2181
|
-
try {
|
|
2182
|
-
const data = (callback.data ?? "").trim();
|
|
2183
|
-
const callbackMessage = callback.message;
|
|
2184
|
-
if (!data || !callbackMessage) return;
|
|
2185
|
-
const editCallbackMessage = async (text, params) => {
|
|
2186
|
-
if (typeof ctx.editMessageText === "function") return await ctx.editMessageText(text, params);
|
|
2187
|
-
return await bot.api.editMessageText(callbackMessage.chat.id, callbackMessage.message_id, text, params);
|
|
2188
|
-
};
|
|
2189
|
-
const clearCallbackButtons = async () => {
|
|
2190
|
-
const replyMarkup = { reply_markup: { inline_keyboard: [] } };
|
|
2191
|
-
if (typeof ctx.editMessageReplyMarkup === "function") return await ctx.editMessageReplyMarkup(replyMarkup);
|
|
2192
|
-
if (typeof bot.api.editMessageReplyMarkup === "function") return await bot.api.editMessageReplyMarkup(callbackMessage.chat.id, callbackMessage.message_id, replyMarkup);
|
|
2193
|
-
const messageText = callbackMessage.text ?? callbackMessage.caption;
|
|
2194
|
-
if (typeof messageText !== "string" || messageText.trim().length === 0) return;
|
|
2195
|
-
return await editCallbackMessage(messageText, replyMarkup);
|
|
2196
|
-
};
|
|
2197
|
-
const editCallbackButtons = async (buttons) => {
|
|
2198
|
-
const replyMarkup = { reply_markup: buildInlineKeyboard(buttons) ?? { inline_keyboard: [] } };
|
|
2199
|
-
if (typeof ctx.editMessageReplyMarkup === "function") return await ctx.editMessageReplyMarkup(replyMarkup);
|
|
2200
|
-
return await bot.api.editMessageReplyMarkup(callbackMessage.chat.id, callbackMessage.message_id, replyMarkup);
|
|
2201
|
-
};
|
|
2202
|
-
const deleteCallbackMessage = async () => {
|
|
2203
|
-
if (typeof ctx.deleteMessage === "function") return await ctx.deleteMessage();
|
|
2204
|
-
return await bot.api.deleteMessage(callbackMessage.chat.id, callbackMessage.message_id);
|
|
2205
|
-
};
|
|
2206
|
-
const replyToCallbackChat = async (text, params) => {
|
|
2207
|
-
if (typeof ctx.reply === "function") return await ctx.reply(text, params);
|
|
2208
|
-
return await bot.api.sendMessage(callbackMessage.chat.id, text, params);
|
|
2209
|
-
};
|
|
2210
|
-
const chatId = callbackMessage.chat.id;
|
|
2211
|
-
const isGroup = callbackMessage.chat.type === "group" || callbackMessage.chat.type === "supergroup";
|
|
2212
|
-
const approvalCallback = parseExecApprovalCommandText(data);
|
|
2213
|
-
const isApprovalCallback = approvalCallback !== null;
|
|
2214
|
-
const inlineButtonsScope = resolveTelegramInlineButtonsScope({
|
|
2215
|
-
cfg,
|
|
2216
|
-
accountId
|
|
2217
|
-
});
|
|
2218
|
-
const execApprovalButtonsEnabled = isApprovalCallback && shouldEnableTelegramExecApprovalButtons({
|
|
2219
|
-
cfg,
|
|
2220
|
-
accountId,
|
|
2221
|
-
to: String(chatId)
|
|
2222
|
-
});
|
|
2223
|
-
if (!execApprovalButtonsEnabled) {
|
|
2224
|
-
if (inlineButtonsScope === "off") return;
|
|
2225
|
-
if (inlineButtonsScope === "dm" && isGroup) return;
|
|
2226
|
-
if (inlineButtonsScope === "group" && !isGroup) return;
|
|
2227
|
-
}
|
|
2228
|
-
const messageThreadId = callbackMessage.message_thread_id;
|
|
2229
|
-
const isForum = await resolveTelegramForumFlag({
|
|
2230
|
-
chatId,
|
|
2231
|
-
chatType: callbackMessage.chat.type,
|
|
2232
|
-
isGroup,
|
|
2233
|
-
isForum: callbackMessage.chat.is_forum,
|
|
2234
|
-
getChat
|
|
2235
|
-
});
|
|
2236
|
-
const eventAuthContext = await resolveTelegramEventAuthorizationContext({
|
|
2237
|
-
chatId,
|
|
2238
|
-
isGroup,
|
|
2239
|
-
isForum,
|
|
2240
|
-
messageThreadId
|
|
2241
|
-
});
|
|
2242
|
-
const { resolvedThreadId, dmThreadId, storeAllowFrom, groupConfig } = eventAuthContext;
|
|
2243
|
-
const requireTopic = groupConfig?.requireTopic;
|
|
2244
|
-
if (!isGroup && requireTopic === true && dmThreadId == null) {
|
|
2245
|
-
logVerbose(`Blocked telegram callback in DM ${chatId}: requireTopic=true but no topic present`);
|
|
2246
|
-
return;
|
|
2247
|
-
}
|
|
2248
|
-
const senderId = callback.from?.id ? String(callback.from.id) : "";
|
|
2249
|
-
const senderUsername = callback.from?.username ?? "";
|
|
2250
|
-
const authorizationMode = !isGroup || !execApprovalButtonsEnabled && inlineButtonsScope === "allowlist" ? "callback-allowlist" : "callback-scope";
|
|
2251
|
-
if (!authorizeTelegramEventSender({
|
|
2252
|
-
chatId,
|
|
2253
|
-
chatTitle: callbackMessage.chat.title,
|
|
2254
|
-
isGroup,
|
|
2255
|
-
senderId,
|
|
2256
|
-
senderUsername,
|
|
2257
|
-
mode: authorizationMode,
|
|
2258
|
-
context: eventAuthContext
|
|
2259
|
-
}).allowed) return;
|
|
2260
|
-
const callbackThreadId = resolvedThreadId ?? dmThreadId;
|
|
2261
|
-
const callbackConversationId = callbackThreadId != null ? `${chatId}:topic:${callbackThreadId}` : String(chatId);
|
|
2262
|
-
const pluginBindingApproval = parsePluginBindingApprovalCustomId(data);
|
|
2263
|
-
if (pluginBindingApproval) {
|
|
2264
|
-
const resolved = await resolvePluginConversationBindingApproval({
|
|
2265
|
-
approvalId: pluginBindingApproval.approvalId,
|
|
2266
|
-
decision: pluginBindingApproval.decision,
|
|
2267
|
-
senderId: senderId || void 0
|
|
2268
|
-
});
|
|
2269
|
-
await clearCallbackButtons();
|
|
2270
|
-
await replyToCallbackChat(buildPluginBindingResolvedText(resolved));
|
|
2271
|
-
return;
|
|
2272
|
-
}
|
|
2273
|
-
if ((await dispatchPluginInteractiveHandler({
|
|
2274
|
-
channel: "telegram",
|
|
2275
|
-
data,
|
|
2276
|
-
callbackId: callback.id,
|
|
2277
|
-
ctx: {
|
|
2278
|
-
accountId,
|
|
2279
|
-
callbackId: callback.id,
|
|
2280
|
-
conversationId: callbackConversationId,
|
|
2281
|
-
parentConversationId: callbackThreadId != null ? String(chatId) : void 0,
|
|
2282
|
-
senderId: senderId || void 0,
|
|
2283
|
-
senderUsername: senderUsername || void 0,
|
|
2284
|
-
threadId: callbackThreadId,
|
|
2285
|
-
isGroup,
|
|
2286
|
-
isForum,
|
|
2287
|
-
auth: { isAuthorizedSender: true },
|
|
2288
|
-
callbackMessage: {
|
|
2289
|
-
messageId: callbackMessage.message_id,
|
|
2290
|
-
chatId: String(chatId),
|
|
2291
|
-
messageText: callbackMessage.text ?? callbackMessage.caption
|
|
2292
|
-
}
|
|
2293
|
-
},
|
|
2294
|
-
respond: {
|
|
2295
|
-
reply: async ({ text, buttons }) => {
|
|
2296
|
-
await replyToCallbackChat(text, buttons ? { reply_markup: buildInlineKeyboard(buttons) } : void 0);
|
|
2297
|
-
},
|
|
2298
|
-
editMessage: async ({ text, buttons }) => {
|
|
2299
|
-
await editCallbackMessage(text, buttons ? { reply_markup: buildInlineKeyboard(buttons) } : void 0);
|
|
2300
|
-
},
|
|
2301
|
-
editButtons: async ({ buttons }) => {
|
|
2302
|
-
await editCallbackButtons(buttons);
|
|
2303
|
-
},
|
|
2304
|
-
clearButtons: async () => {
|
|
2305
|
-
await clearCallbackButtons();
|
|
2306
|
-
},
|
|
2307
|
-
deleteMessage: async () => {
|
|
2308
|
-
await deleteCallbackMessage();
|
|
2309
|
-
}
|
|
2310
|
-
}
|
|
2311
|
-
})).handled) return;
|
|
2312
|
-
const runtimeCfg = telegramDeps.loadConfig();
|
|
2313
|
-
if (approvalCallback) {
|
|
2314
|
-
const isPluginApproval = approvalCallback.approvalId.startsWith("plugin:");
|
|
2315
|
-
const pluginApprovalAuthorizedSender = isTelegramExecApprovalApprover({
|
|
2316
|
-
cfg: runtimeCfg,
|
|
2317
|
-
accountId,
|
|
2318
|
-
senderId
|
|
2319
|
-
});
|
|
2320
|
-
const execApprovalAuthorizedSender = isTelegramExecApprovalAuthorizedSender({
|
|
2321
|
-
cfg: runtimeCfg,
|
|
2322
|
-
accountId,
|
|
2323
|
-
senderId
|
|
2324
|
-
});
|
|
2325
|
-
if (!(isPluginApproval ? pluginApprovalAuthorizedSender : execApprovalAuthorizedSender || pluginApprovalAuthorizedSender)) {
|
|
2326
|
-
logVerbose(`Blocked telegram approval callback from ${senderId || "unknown"} (not authorized)`);
|
|
2327
|
-
return;
|
|
2328
|
-
}
|
|
2329
|
-
try {
|
|
2330
|
-
await (telegramDeps.resolveExecApproval ?? resolveTelegramExecApproval)({
|
|
2331
|
-
cfg: runtimeCfg,
|
|
2332
|
-
approvalId: approvalCallback.approvalId,
|
|
2333
|
-
decision: approvalCallback.decision,
|
|
2334
|
-
senderId,
|
|
2335
|
-
allowPluginFallback: pluginApprovalAuthorizedSender
|
|
2336
|
-
});
|
|
2337
|
-
} catch (resolveErr) {
|
|
2338
|
-
const errStr = String(resolveErr);
|
|
2339
|
-
logVerbose(`telegram: failed to resolve approval callback ${approvalCallback.approvalId}: ${errStr}`);
|
|
2340
|
-
await replyToCallbackChat("❌ Failed to submit approval. Please try again or contact an admin.");
|
|
2341
|
-
return;
|
|
2342
|
-
}
|
|
2343
|
-
try {
|
|
2344
|
-
await clearCallbackButtons();
|
|
2345
|
-
} catch (editErr) {
|
|
2346
|
-
const errStr = String(editErr);
|
|
2347
|
-
if (errStr.includes("message is not modified") || errStr.includes("there is no text in the message to edit")) return;
|
|
2348
|
-
logVerbose(`telegram: failed to clear approval callback buttons: ${errStr}`);
|
|
2349
|
-
}
|
|
2350
|
-
return;
|
|
2351
|
-
}
|
|
2352
|
-
const paginationMatch = data.match(/^commands_page_(\d+|noop)(?::(.+))?$/);
|
|
2353
|
-
if (paginationMatch) {
|
|
2354
|
-
const pageValue = paginationMatch[1];
|
|
2355
|
-
if (pageValue === "noop") return;
|
|
2356
|
-
const page = Number.parseInt(pageValue, 10);
|
|
2357
|
-
if (Number.isNaN(page) || page < 1) return;
|
|
2358
|
-
const agentId = paginationMatch[2]?.trim() || resolveDefaultAgentId(runtimeCfg);
|
|
2359
|
-
const result = buildCommandsMessagePaginated(runtimeCfg, telegramDeps.listSkillCommandsForAgents({
|
|
2360
|
-
cfg: runtimeCfg,
|
|
2361
|
-
agentIds: [agentId]
|
|
2362
|
-
}), {
|
|
2363
|
-
page,
|
|
2364
|
-
surface: "telegram"
|
|
2365
|
-
});
|
|
2366
|
-
const keyboard = result.totalPages > 1 ? buildInlineKeyboard(buildCommandsPaginationKeyboard(result.currentPage, result.totalPages, agentId)) : void 0;
|
|
2367
|
-
try {
|
|
2368
|
-
await editCallbackMessage(result.text, keyboard ? { reply_markup: keyboard } : void 0);
|
|
2369
|
-
} catch (editErr) {
|
|
2370
|
-
if (!String(editErr).includes("message is not modified")) throw editErr;
|
|
2371
|
-
}
|
|
2372
|
-
return;
|
|
2373
|
-
}
|
|
2374
|
-
const modelCallback = parseModelCallbackData(data);
|
|
2375
|
-
if (modelCallback) {
|
|
2376
|
-
const sessionState = resolveTelegramSessionState({
|
|
2377
|
-
chatId,
|
|
2378
|
-
isGroup,
|
|
2379
|
-
isForum,
|
|
2380
|
-
messageThreadId,
|
|
2381
|
-
resolvedThreadId,
|
|
2382
|
-
senderId
|
|
2383
|
-
});
|
|
2384
|
-
const { byProvider, providers } = await telegramDeps.buildModelsProviderData(runtimeCfg, sessionState.agentId);
|
|
2385
|
-
const editMessageWithButtons = async (text, buttons) => {
|
|
2386
|
-
const keyboard = buildInlineKeyboard(buttons);
|
|
2387
|
-
try {
|
|
2388
|
-
await editCallbackMessage(text, keyboard ? { reply_markup: keyboard } : void 0);
|
|
2389
|
-
} catch (editErr) {
|
|
2390
|
-
const errStr = String(editErr);
|
|
2391
|
-
if (errStr.includes("no text in the message")) {
|
|
2392
|
-
try {
|
|
2393
|
-
await deleteCallbackMessage();
|
|
2394
|
-
} catch {}
|
|
2395
|
-
await replyToCallbackChat(text, keyboard ? { reply_markup: keyboard } : void 0);
|
|
2396
|
-
} else if (!errStr.includes("message is not modified")) throw editErr;
|
|
2397
|
-
}
|
|
2398
|
-
};
|
|
2399
|
-
if (modelCallback.type === "providers" || modelCallback.type === "back") {
|
|
2400
|
-
if (providers.length === 0) {
|
|
2401
|
-
await editMessageWithButtons("No providers available.", []);
|
|
2402
|
-
return;
|
|
2403
|
-
}
|
|
2404
|
-
await editMessageWithButtons("Select a provider:", buildProviderKeyboard(providers.map((p) => ({
|
|
2405
|
-
id: p,
|
|
2406
|
-
count: byProvider.get(p)?.size ?? 0
|
|
2407
|
-
}))));
|
|
2408
|
-
return;
|
|
2409
|
-
}
|
|
2410
|
-
if (modelCallback.type === "list") {
|
|
2411
|
-
const { provider, page } = modelCallback;
|
|
2412
|
-
const modelSet = byProvider.get(provider);
|
|
2413
|
-
if (!modelSet || modelSet.size === 0) {
|
|
2414
|
-
const buttons = buildProviderKeyboard(providers.map((p) => ({
|
|
2415
|
-
id: p,
|
|
2416
|
-
count: byProvider.get(p)?.size ?? 0
|
|
2417
|
-
})));
|
|
2418
|
-
await editMessageWithButtons(`Unknown provider: ${provider}\n\nSelect a provider:`, buttons);
|
|
2419
|
-
return;
|
|
2420
|
-
}
|
|
2421
|
-
const models = [...modelSet].toSorted();
|
|
2422
|
-
const pageSize = getModelsPageSize();
|
|
2423
|
-
const totalPages = calculateTotalPages(models.length, pageSize);
|
|
2424
|
-
const safePage = Math.max(1, Math.min(page, totalPages));
|
|
2425
|
-
const currentSessionState = resolveTelegramSessionState({
|
|
2426
|
-
chatId,
|
|
2427
|
-
isGroup,
|
|
2428
|
-
isForum,
|
|
2429
|
-
messageThreadId,
|
|
2430
|
-
resolvedThreadId,
|
|
2431
|
-
senderId
|
|
2432
|
-
});
|
|
2433
|
-
const currentModel = currentSessionState.model;
|
|
2434
|
-
const buttons = buildModelsKeyboard({
|
|
2435
|
-
provider,
|
|
2436
|
-
models,
|
|
2437
|
-
currentModel,
|
|
2438
|
-
currentPage: safePage,
|
|
2439
|
-
totalPages,
|
|
2440
|
-
pageSize
|
|
2441
|
-
});
|
|
2442
|
-
await editMessageWithButtons(formatModelsAvailableHeader({
|
|
2443
|
-
provider,
|
|
2444
|
-
total: models.length,
|
|
2445
|
-
cfg,
|
|
2446
|
-
agentDir: resolveAgentDir(cfg, currentSessionState.agentId),
|
|
2447
|
-
sessionEntry: currentSessionState.sessionEntry
|
|
2448
|
-
}), buttons);
|
|
2449
|
-
return;
|
|
2450
|
-
}
|
|
2451
|
-
if (modelCallback.type === "select") {
|
|
2452
|
-
const selection = resolveModelSelection({
|
|
2453
|
-
callback: modelCallback,
|
|
2454
|
-
providers,
|
|
2455
|
-
byProvider
|
|
2456
|
-
});
|
|
2457
|
-
if (selection.kind !== "resolved") {
|
|
2458
|
-
const buttons = buildProviderKeyboard(providers.map((p) => ({
|
|
2459
|
-
id: p,
|
|
2460
|
-
count: byProvider.get(p)?.size ?? 0
|
|
2461
|
-
})));
|
|
2462
|
-
await editMessageWithButtons(`Could not resolve model "${selection.model}".\n\nSelect a provider:`, buttons);
|
|
2463
|
-
return;
|
|
2464
|
-
}
|
|
2465
|
-
if (!byProvider.get(selection.provider)?.has(selection.model)) {
|
|
2466
|
-
await editMessageWithButtons(`❌ Model "${selection.provider}/${selection.model}" is not allowed.`, []);
|
|
2467
|
-
return;
|
|
2468
|
-
}
|
|
2469
|
-
try {
|
|
2470
|
-
const storePath = telegramDeps.resolveStorePath(cfg.session?.store, { agentId: sessionState.agentId });
|
|
2471
|
-
const resolvedDefault = resolveDefaultModelForAgent({
|
|
2472
|
-
cfg,
|
|
2473
|
-
agentId: sessionState.agentId
|
|
2474
|
-
});
|
|
2475
|
-
const isDefaultSelection = selection.provider === resolvedDefault.provider && selection.model === resolvedDefault.model;
|
|
2476
|
-
await updateSessionStore(storePath, (store) => {
|
|
2477
|
-
const sessionKey = sessionState.sessionKey;
|
|
2478
|
-
const entry = store[sessionKey] ?? {};
|
|
2479
|
-
store[sessionKey] = entry;
|
|
2480
|
-
applyModelOverrideToSessionEntry({
|
|
2481
|
-
entry,
|
|
2482
|
-
selection: {
|
|
2483
|
-
provider: selection.provider,
|
|
2484
|
-
model: selection.model,
|
|
2485
|
-
isDefault: isDefaultSelection
|
|
2486
|
-
}
|
|
2487
|
-
});
|
|
2488
|
-
});
|
|
2489
|
-
await editMessageWithButtons(`✅ Model ${isDefaultSelection ? "reset to default" : `changed to **${selection.provider}/${selection.model}**`}\n\nThis model will be used for your next message.`, []);
|
|
2490
|
-
} catch (err) {
|
|
2491
|
-
await editMessageWithButtons(`❌ Failed to change model: ${String(err)}`, []);
|
|
2492
|
-
}
|
|
2493
|
-
return;
|
|
2494
|
-
}
|
|
2495
|
-
return;
|
|
2496
|
-
}
|
|
2497
|
-
const nativeCallbackCommand = parseTelegramNativeCommandCallbackData(data);
|
|
2498
|
-
await processMessage(buildSyntheticContext(ctx, buildSyntheticTextMessage({
|
|
2499
|
-
base: withResolvedTelegramForumFlag(callbackMessage, isForum),
|
|
2500
|
-
from: callback.from,
|
|
2501
|
-
text: nativeCallbackCommand ?? data
|
|
2502
|
-
})), [], storeAllowFrom, {
|
|
2503
|
-
...nativeCallbackCommand ? { commandSource: "native" } : {},
|
|
2504
|
-
forceWasMentioned: true,
|
|
2505
|
-
messageIdOverride: callback.id
|
|
2506
|
-
});
|
|
2507
|
-
} catch (err) {
|
|
2508
|
-
runtime.error?.(danger(`callback handler failed: ${String(err)}`));
|
|
2509
|
-
}
|
|
2510
|
-
});
|
|
2511
|
-
bot.on("message:migrate_to_chat_id", async (ctx) => {
|
|
2512
|
-
try {
|
|
2513
|
-
const msg = ctx.message;
|
|
2514
|
-
if (!msg?.migrate_to_chat_id) return;
|
|
2515
|
-
if (shouldSkipUpdate(ctx)) return;
|
|
2516
|
-
const oldChatId = String(msg.chat.id);
|
|
2517
|
-
const newChatId = String(msg.migrate_to_chat_id);
|
|
2518
|
-
const chatTitle = msg.chat.title ?? "Unknown";
|
|
2519
|
-
runtime.log?.(warn(`[telegram] Group migrated: "${chatTitle}" ${oldChatId} → ${newChatId}`));
|
|
2520
|
-
if (!resolveChannelConfigWrites({
|
|
2521
|
-
cfg,
|
|
2522
|
-
channelId: "telegram",
|
|
2523
|
-
accountId
|
|
2524
|
-
})) {
|
|
2525
|
-
runtime.log?.(warn("[telegram] Config writes disabled; skipping group config migration."));
|
|
2526
|
-
return;
|
|
2527
|
-
}
|
|
2528
|
-
const currentConfig = telegramDeps.loadConfig();
|
|
2529
|
-
const migration = migrateTelegramGroupConfig({
|
|
2530
|
-
cfg: currentConfig,
|
|
2531
|
-
accountId,
|
|
2532
|
-
oldChatId,
|
|
2533
|
-
newChatId
|
|
2534
|
-
});
|
|
2535
|
-
if (migration.migrated) {
|
|
2536
|
-
runtime.log?.(warn(`[telegram] Migrating group config from ${oldChatId} to ${newChatId}`));
|
|
2537
|
-
migrateTelegramGroupConfig({
|
|
2538
|
-
cfg,
|
|
2539
|
-
accountId,
|
|
2540
|
-
oldChatId,
|
|
2541
|
-
newChatId
|
|
2542
|
-
});
|
|
2543
|
-
await writeConfigFile(currentConfig);
|
|
2544
|
-
runtime.log?.(warn(`[telegram] Group config migrated and saved successfully`));
|
|
2545
|
-
} else if (migration.skippedExisting) runtime.log?.(warn(`[telegram] Group config already exists for ${newChatId}; leaving ${oldChatId} unchanged`));
|
|
2546
|
-
else runtime.log?.(warn(`[telegram] No config found for old group ID ${oldChatId}, migration logged only`));
|
|
2547
|
-
} catch (err) {
|
|
2548
|
-
runtime.error?.(danger(`[telegram] Group migration handler failed: ${String(err)}`));
|
|
2549
|
-
}
|
|
2550
|
-
});
|
|
2551
|
-
const handleInboundMessageLike = async (event) => {
|
|
2552
|
-
try {
|
|
2553
|
-
if (shouldSkipUpdate(event.ctxForDedupe)) return;
|
|
2554
|
-
const { dmPolicy, resolvedThreadId, dmThreadId, storeAllowFrom, groupConfig, topicConfig, groupAllowOverride, effectiveGroupAllow, hasGroupAllowOverride } = await resolveTelegramEventAuthorizationContext({
|
|
2555
|
-
chatId: event.chatId,
|
|
2556
|
-
isGroup: event.isGroup,
|
|
2557
|
-
isForum: event.isForum,
|
|
2558
|
-
messageThreadId: event.messageThreadId
|
|
2559
|
-
});
|
|
2560
|
-
const effectiveDmAllow = normalizeDmAllowFromWithStore({
|
|
2561
|
-
allowFrom: groupAllowOverride ?? allowFrom,
|
|
2562
|
-
storeAllowFrom,
|
|
2563
|
-
dmPolicy
|
|
2564
|
-
});
|
|
2565
|
-
if (event.requireConfiguredGroup && (!groupConfig || groupConfig.enabled === false)) {
|
|
2566
|
-
logVerbose(`Blocked telegram channel ${event.chatId} (channel disabled)`);
|
|
2567
|
-
return;
|
|
2568
|
-
}
|
|
2569
|
-
if (shouldSkipGroupMessage({
|
|
2570
|
-
isGroup: event.isGroup,
|
|
2571
|
-
chatId: event.chatId,
|
|
2572
|
-
chatTitle: event.msg.chat.title,
|
|
2573
|
-
resolvedThreadId,
|
|
2574
|
-
senderId: event.senderId,
|
|
2575
|
-
senderUsername: event.senderUsername,
|
|
2576
|
-
effectiveGroupAllow,
|
|
2577
|
-
hasGroupAllowOverride,
|
|
2578
|
-
groupConfig,
|
|
2579
|
-
topicConfig
|
|
2580
|
-
})) return;
|
|
2581
|
-
if (!event.isGroup && (hasInboundMedia(event.msg) || hasReplyTargetMedia(event.msg))) {
|
|
2582
|
-
if (!await enforceTelegramDmAccess({
|
|
2583
|
-
isGroup: event.isGroup,
|
|
2584
|
-
dmPolicy,
|
|
2585
|
-
msg: event.msg,
|
|
2586
|
-
chatId: event.chatId,
|
|
2587
|
-
effectiveDmAllow,
|
|
2588
|
-
accountId,
|
|
2589
|
-
bot,
|
|
2590
|
-
logger,
|
|
2591
|
-
upsertPairingRequest: telegramDeps.upsertChannelPairingRequest
|
|
2592
|
-
})) return;
|
|
2593
|
-
}
|
|
2594
|
-
await processInboundMessage({
|
|
2595
|
-
ctx: event.ctx,
|
|
2596
|
-
msg: event.msg,
|
|
2597
|
-
chatId: event.chatId,
|
|
2598
|
-
resolvedThreadId,
|
|
2599
|
-
dmThreadId,
|
|
2600
|
-
storeAllowFrom,
|
|
2601
|
-
sendOversizeWarning: event.sendOversizeWarning,
|
|
2602
|
-
oversizeLogMessage: event.oversizeLogMessage
|
|
2603
|
-
});
|
|
2604
|
-
} catch (err) {
|
|
2605
|
-
runtime.error?.(danger(`${event.errorMessage}: ${String(err)}`));
|
|
2606
|
-
}
|
|
2607
|
-
};
|
|
2608
|
-
bot.on("message", async (ctx) => {
|
|
2609
|
-
const msg = ctx.message;
|
|
2610
|
-
if (!msg) return;
|
|
2611
|
-
const isGroup = msg.chat.type === "group" || msg.chat.type === "supergroup";
|
|
2612
|
-
const isForum = await resolveTelegramForumFlag({
|
|
2613
|
-
chatId: msg.chat.id,
|
|
2614
|
-
chatType: msg.chat.type,
|
|
2615
|
-
isGroup,
|
|
2616
|
-
isForum: msg.chat.is_forum,
|
|
2617
|
-
getChat
|
|
2618
|
-
});
|
|
2619
|
-
const normalizedMsg = withResolvedTelegramForumFlag(msg, isForum);
|
|
2620
|
-
if (normalizedMsg.from?.id != null && normalizedMsg.from.id === ctx.me?.id) return;
|
|
2621
|
-
await handleInboundMessageLike({
|
|
2622
|
-
ctxForDedupe: ctx,
|
|
2623
|
-
ctx: buildSyntheticContext(ctx, normalizedMsg),
|
|
2624
|
-
msg: normalizedMsg,
|
|
2625
|
-
chatId: normalizedMsg.chat.id,
|
|
2626
|
-
isGroup,
|
|
2627
|
-
isForum,
|
|
2628
|
-
messageThreadId: normalizedMsg.message_thread_id,
|
|
2629
|
-
senderId: normalizedMsg.from?.id != null ? String(normalizedMsg.from.id) : "",
|
|
2630
|
-
senderUsername: normalizedMsg.from?.username ?? "",
|
|
2631
|
-
requireConfiguredGroup: false,
|
|
2632
|
-
sendOversizeWarning: true,
|
|
2633
|
-
oversizeLogMessage: "media exceeds size limit",
|
|
2634
|
-
errorMessage: "handler failed"
|
|
2635
|
-
});
|
|
2636
|
-
});
|
|
2637
|
-
bot.on("channel_post", async (ctx) => {
|
|
2638
|
-
const post = ctx.channelPost;
|
|
2639
|
-
if (!post) return;
|
|
2640
|
-
const chatId = post.chat.id;
|
|
2641
|
-
const syntheticFrom = post.sender_chat ? {
|
|
2642
|
-
id: post.sender_chat.id,
|
|
2643
|
-
is_bot: true,
|
|
2644
|
-
first_name: post.sender_chat.title || "Channel",
|
|
2645
|
-
username: post.sender_chat.username
|
|
2646
|
-
} : {
|
|
2647
|
-
id: chatId,
|
|
2648
|
-
is_bot: true,
|
|
2649
|
-
first_name: post.chat.title || "Channel",
|
|
2650
|
-
username: post.chat.username
|
|
2651
|
-
};
|
|
2652
|
-
const syntheticMsg = {
|
|
2653
|
-
...post,
|
|
2654
|
-
from: post.from ?? syntheticFrom,
|
|
2655
|
-
chat: {
|
|
2656
|
-
...post.chat,
|
|
2657
|
-
type: "supergroup"
|
|
2658
|
-
}
|
|
2659
|
-
};
|
|
2660
|
-
await handleInboundMessageLike({
|
|
2661
|
-
ctxForDedupe: ctx,
|
|
2662
|
-
ctx: buildSyntheticContext(ctx, syntheticMsg),
|
|
2663
|
-
msg: syntheticMsg,
|
|
2664
|
-
chatId,
|
|
2665
|
-
isGroup: true,
|
|
2666
|
-
isForum: false,
|
|
2667
|
-
senderId: post.sender_chat?.id != null ? String(post.sender_chat.id) : post.from?.id != null ? String(post.from.id) : "",
|
|
2668
|
-
senderUsername: post.sender_chat?.username ?? post.from?.username ?? "",
|
|
2669
|
-
requireConfiguredGroup: true,
|
|
2670
|
-
sendOversizeWarning: false,
|
|
2671
|
-
oversizeLogMessage: "channel post media exceeds size limit",
|
|
2672
|
-
errorMessage: "channel_post handler failed"
|
|
2673
|
-
});
|
|
2674
|
-
});
|
|
2675
|
-
};
|
|
2676
|
-
//#endregion
|
|
2677
|
-
//#region extensions/telegram/src/error-policy.ts
|
|
2678
|
-
const errorCooldownStore = /* @__PURE__ */ new Map();
|
|
2679
|
-
const DEFAULT_ERROR_COOLDOWN_MS = 144e5;
|
|
2680
|
-
function pruneExpiredCooldowns(messageStore, now) {
|
|
2681
|
-
for (const [message, expiresAt] of messageStore) if (expiresAt <= now) messageStore.delete(message);
|
|
2682
|
-
}
|
|
2683
|
-
function resolveTelegramErrorPolicy(params) {
|
|
2684
|
-
const configs = [
|
|
2685
|
-
params.accountConfig,
|
|
2686
|
-
params.groupConfig,
|
|
2687
|
-
params.topicConfig
|
|
2688
|
-
];
|
|
2689
|
-
let policy = "always";
|
|
2690
|
-
let cooldownMs = DEFAULT_ERROR_COOLDOWN_MS;
|
|
2691
|
-
for (const config of configs) {
|
|
2692
|
-
if (config?.errorPolicy) policy = config.errorPolicy;
|
|
2693
|
-
if (typeof config?.errorCooldownMs === "number") cooldownMs = config.errorCooldownMs;
|
|
2694
|
-
}
|
|
2695
|
-
return {
|
|
2696
|
-
policy,
|
|
2697
|
-
cooldownMs
|
|
2698
|
-
};
|
|
2699
|
-
}
|
|
2700
|
-
function buildTelegramErrorScopeKey(params) {
|
|
2701
|
-
const threadId = params.threadId == null ? "main" : String(params.threadId);
|
|
2702
|
-
return `${params.accountId}:${String(params.chatId)}:${threadId}`;
|
|
2703
|
-
}
|
|
2704
|
-
function shouldSuppressTelegramError(params) {
|
|
2705
|
-
const { scopeKey, cooldownMs, errorMessage } = params;
|
|
2706
|
-
const now = Date.now();
|
|
2707
|
-
const messageKey = errorMessage ?? "";
|
|
2708
|
-
const scopeStore = errorCooldownStore.get(scopeKey);
|
|
2709
|
-
if (scopeStore) {
|
|
2710
|
-
pruneExpiredCooldowns(scopeStore, now);
|
|
2711
|
-
if (scopeStore.size === 0) errorCooldownStore.delete(scopeKey);
|
|
2712
|
-
}
|
|
2713
|
-
if (errorCooldownStore.size > 100) for (const [scope, messageStore] of errorCooldownStore) {
|
|
2714
|
-
pruneExpiredCooldowns(messageStore, now);
|
|
2715
|
-
if (messageStore.size === 0) errorCooldownStore.delete(scope);
|
|
2716
|
-
}
|
|
2717
|
-
const expiresAt = scopeStore?.get(messageKey);
|
|
2718
|
-
if (typeof expiresAt === "number" && expiresAt > now) return true;
|
|
2719
|
-
const nextScopeStore = scopeStore ?? /* @__PURE__ */ new Map();
|
|
2720
|
-
nextScopeStore.set(messageKey, now + cooldownMs);
|
|
2721
|
-
errorCooldownStore.set(scopeKey, nextScopeStore);
|
|
2722
|
-
return false;
|
|
2723
|
-
}
|
|
2724
|
-
function isSilentErrorPolicy(policy) {
|
|
2725
|
-
return policy === "silent";
|
|
2726
|
-
}
|
|
2727
|
-
//#endregion
|
|
2728
|
-
//#region extensions/telegram/src/lane-delivery-text-deliverer.ts
|
|
2729
|
-
const MESSAGE_NOT_MODIFIED_RE = /400:\s*Bad Request:\s*message is not modified|MESSAGE_NOT_MODIFIED/i;
|
|
2730
|
-
const MESSAGE_NOT_FOUND_RE = /400:\s*Bad Request:\s*message to edit not found|MESSAGE_ID_INVALID|message can't be edited/i;
|
|
2731
|
-
function extractErrorText(err) {
|
|
2732
|
-
return typeof err === "string" ? err : err instanceof Error ? err.message : typeof err === "object" && err && "description" in err ? typeof err.description === "string" ? err.description : "" : "";
|
|
2733
|
-
}
|
|
2734
|
-
function isMessageNotModifiedError(err) {
|
|
2735
|
-
return MESSAGE_NOT_MODIFIED_RE.test(extractErrorText(err));
|
|
2736
|
-
}
|
|
2737
|
-
/**
|
|
2738
|
-
* Returns true when Telegram rejects an edit because the target message can no
|
|
2739
|
-
* longer be resolved or edited. The caller still needs preview context to
|
|
2740
|
-
* decide whether to retain a different visible preview or fall back to send.
|
|
2741
|
-
*/
|
|
2742
|
-
function isMissingPreviewMessageError(err) {
|
|
2743
|
-
return MESSAGE_NOT_FOUND_RE.test(extractErrorText(err));
|
|
2744
|
-
}
|
|
2745
|
-
function result(kind, delivery) {
|
|
2746
|
-
if (kind === "preview-finalized") return {
|
|
2747
|
-
kind,
|
|
2748
|
-
delivery
|
|
2749
|
-
};
|
|
2750
|
-
return { kind };
|
|
2751
|
-
}
|
|
2752
|
-
function shouldSkipRegressivePreviewUpdate(args) {
|
|
2753
|
-
const currentPreviewText = args.currentPreviewText;
|
|
2754
|
-
if (currentPreviewText === void 0) return false;
|
|
2755
|
-
return currentPreviewText.startsWith(args.text) && args.text.length < currentPreviewText.length && (args.skipRegressive === "always" || args.hadPreviewMessage);
|
|
2756
|
-
}
|
|
2757
|
-
function resolvePreviewTarget(params) {
|
|
2758
|
-
const lanePreviewMessageId = params.lane.stream?.messageId();
|
|
2759
|
-
const previewMessageId = typeof params.previewMessageIdOverride === "number" ? params.previewMessageIdOverride : lanePreviewMessageId;
|
|
2760
|
-
const hadPreviewMessage = typeof params.previewMessageIdOverride === "number" || typeof lanePreviewMessageId === "number";
|
|
2761
|
-
return {
|
|
2762
|
-
hadPreviewMessage,
|
|
2763
|
-
previewMessageId: typeof previewMessageId === "number" ? previewMessageId : void 0,
|
|
2764
|
-
stopCreatesFirstPreview: params.stopBeforeEdit && !hadPreviewMessage && params.context === "final"
|
|
2765
|
-
};
|
|
2766
|
-
}
|
|
2767
|
-
function createLaneTextDeliverer(params) {
|
|
2768
|
-
const getLanePreviewText = (lane) => lane.lastPartialText;
|
|
2769
|
-
const markActivePreviewComplete = (laneName) => {
|
|
2770
|
-
params.activePreviewLifecycleByLane[laneName] = "complete";
|
|
2771
|
-
params.retainPreviewOnCleanupByLane[laneName] = true;
|
|
2772
|
-
};
|
|
2773
|
-
const isDraftPreviewLane = (lane) => lane.stream?.previewMode?.() === "draft";
|
|
2774
|
-
const canMaterializeDraftFinal = (lane, previewButtons) => {
|
|
2775
|
-
const hasPreviewButtons = Boolean(previewButtons && previewButtons.length > 0);
|
|
2776
|
-
return isDraftPreviewLane(lane) && !hasPreviewButtons && typeof lane.stream?.materialize === "function";
|
|
2777
|
-
};
|
|
2778
|
-
const tryMaterializeDraftPreviewForFinal = async (args) => {
|
|
2779
|
-
const stream = args.lane.stream;
|
|
2780
|
-
if (!stream || !isDraftPreviewLane(args.lane)) return;
|
|
2781
|
-
stream.update(args.text);
|
|
2782
|
-
const materializedMessageId = await stream.materialize?.();
|
|
2783
|
-
if (typeof materializedMessageId !== "number") {
|
|
2784
|
-
params.log(`telegram: ${args.laneName} draft preview materialize produced no message id; falling back to standard send`);
|
|
2785
|
-
return;
|
|
2786
|
-
}
|
|
2787
|
-
args.lane.lastPartialText = args.text;
|
|
2788
|
-
params.markDelivered();
|
|
2789
|
-
return materializedMessageId;
|
|
2790
|
-
};
|
|
2791
|
-
const tryEditPreviewMessage = async (args) => {
|
|
2792
|
-
try {
|
|
2793
|
-
await params.editPreview({
|
|
2794
|
-
laneName: args.laneName,
|
|
2795
|
-
messageId: args.messageId,
|
|
2796
|
-
text: args.text,
|
|
2797
|
-
previewButtons: args.previewButtons,
|
|
2798
|
-
context: args.context
|
|
2799
|
-
});
|
|
2800
|
-
if (args.updateLaneSnapshot) args.lane.lastPartialText = args.text;
|
|
2801
|
-
params.markDelivered();
|
|
2802
|
-
return "edited";
|
|
2803
|
-
} catch (err) {
|
|
2804
|
-
if (isMessageNotModifiedError(err)) {
|
|
2805
|
-
params.log(`telegram: ${args.laneName} preview ${args.context} edit returned "message is not modified"; treating as delivered`);
|
|
2806
|
-
params.markDelivered();
|
|
2807
|
-
return "edited";
|
|
2808
|
-
}
|
|
2809
|
-
if (args.context === "final") {
|
|
2810
|
-
if (args.finalTextAlreadyLanded) {
|
|
2811
|
-
params.log(`telegram: ${args.laneName} preview final edit failed after stop flush; keeping existing preview (${String(err)})`);
|
|
2812
|
-
params.markDelivered();
|
|
2813
|
-
return "retained";
|
|
2814
|
-
}
|
|
2815
|
-
if (isSafeToRetrySendError(err)) {
|
|
2816
|
-
params.log(`telegram: ${args.laneName} preview final edit failed before reaching Telegram; falling back to standard send (${String(err)})`);
|
|
2817
|
-
return "fallback";
|
|
2818
|
-
}
|
|
2819
|
-
if (isMissingPreviewMessageError(err)) {
|
|
2820
|
-
if (args.retainAlternatePreviewOnMissingTarget) {
|
|
2821
|
-
params.log(`telegram: ${args.laneName} preview final edit target missing; keeping alternate preview without fallback (${String(err)})`);
|
|
2822
|
-
params.markDelivered();
|
|
2823
|
-
return "retained";
|
|
2824
|
-
}
|
|
2825
|
-
params.log(`telegram: ${args.laneName} preview final edit target missing with no alternate preview; falling back to standard send (${String(err)})`);
|
|
2826
|
-
return "fallback";
|
|
2827
|
-
}
|
|
2828
|
-
if (isRecoverableTelegramNetworkError(err, { allowMessageMatch: true })) {
|
|
2829
|
-
params.log(`telegram: ${args.laneName} preview final edit may have landed despite network error; keeping existing preview (${String(err)})`);
|
|
2830
|
-
params.markDelivered();
|
|
2831
|
-
return "retained";
|
|
2832
|
-
}
|
|
2833
|
-
if (isTelegramClientRejection(err)) {
|
|
2834
|
-
params.log(`telegram: ${args.laneName} preview final edit rejected by Telegram (client error); falling back to standard send (${String(err)})`);
|
|
2835
|
-
return "fallback";
|
|
2836
|
-
}
|
|
2837
|
-
params.log(`telegram: ${args.laneName} preview final edit failed with ambiguous error; keeping existing preview to avoid duplicate (${String(err)})`);
|
|
2838
|
-
params.markDelivered();
|
|
2839
|
-
return "retained";
|
|
2840
|
-
}
|
|
2841
|
-
params.log(`telegram: ${args.laneName} preview ${args.context} edit failed; falling back to standard send (${String(err)})`);
|
|
2842
|
-
return "fallback";
|
|
2843
|
-
}
|
|
2844
|
-
};
|
|
2845
|
-
const tryUpdatePreviewForLane = async ({ lane, laneName, text, previewButtons, stopBeforeEdit = false, updateLaneSnapshot = false, skipRegressive, context, previewMessageId: previewMessageIdOverride, previewTextSnapshot }) => {
|
|
2846
|
-
const editPreview = (messageId, finalTextAlreadyLanded, retainAlternatePreviewOnMissingTarget) => tryEditPreviewMessage({
|
|
2847
|
-
laneName,
|
|
2848
|
-
messageId,
|
|
2849
|
-
text,
|
|
2850
|
-
context,
|
|
2851
|
-
previewButtons,
|
|
2852
|
-
updateLaneSnapshot,
|
|
2853
|
-
lane,
|
|
2854
|
-
finalTextAlreadyLanded,
|
|
2855
|
-
retainAlternatePreviewOnMissingTarget
|
|
2856
|
-
});
|
|
2857
|
-
const finalizePreview = (previewMessageId, finalTextAlreadyLanded, hadPreviewMessage, retainAlternatePreviewOnMissingTarget = false) => {
|
|
2858
|
-
if (shouldSkipRegressivePreviewUpdate({
|
|
2859
|
-
currentPreviewText: previewTextSnapshot ?? getLanePreviewText(lane),
|
|
2860
|
-
text,
|
|
2861
|
-
skipRegressive,
|
|
2862
|
-
hadPreviewMessage
|
|
2863
|
-
})) {
|
|
2864
|
-
params.markDelivered();
|
|
2865
|
-
return "regressive-skipped";
|
|
2866
|
-
}
|
|
2867
|
-
return editPreview(previewMessageId, finalTextAlreadyLanded, retainAlternatePreviewOnMissingTarget);
|
|
2868
|
-
};
|
|
2869
|
-
if (!lane.stream) return "fallback";
|
|
2870
|
-
if (resolvePreviewTarget({
|
|
2871
|
-
lane,
|
|
2872
|
-
previewMessageIdOverride,
|
|
2873
|
-
stopBeforeEdit,
|
|
2874
|
-
context
|
|
2875
|
-
}).stopCreatesFirstPreview) {
|
|
2876
|
-
lane.stream.update(text);
|
|
2877
|
-
await params.stopDraftLane(lane);
|
|
2878
|
-
const previewTargetAfterStop = resolvePreviewTarget({
|
|
2879
|
-
lane,
|
|
2880
|
-
stopBeforeEdit: false,
|
|
2881
|
-
context
|
|
2882
|
-
});
|
|
2883
|
-
if (typeof previewTargetAfterStop.previewMessageId !== "number") return "fallback";
|
|
2884
|
-
return finalizePreview(previewTargetAfterStop.previewMessageId, true, false);
|
|
2885
|
-
}
|
|
2886
|
-
if (stopBeforeEdit) await params.stopDraftLane(lane);
|
|
2887
|
-
const previewTargetAfterStop = resolvePreviewTarget({
|
|
2888
|
-
lane,
|
|
2889
|
-
previewMessageIdOverride,
|
|
2890
|
-
stopBeforeEdit: false,
|
|
2891
|
-
context
|
|
2892
|
-
});
|
|
2893
|
-
if (typeof previewTargetAfterStop.previewMessageId !== "number") {
|
|
2894
|
-
if (context === "final" && lane.hasStreamedMessage && lane.stream?.sendMayHaveLanded?.()) {
|
|
2895
|
-
params.log(`telegram: ${laneName} preview send may have landed despite missing message id; keeping to avoid duplicate`);
|
|
2896
|
-
params.markDelivered();
|
|
2897
|
-
return "retained";
|
|
2898
|
-
}
|
|
2899
|
-
return "fallback";
|
|
2900
|
-
}
|
|
2901
|
-
const activePreviewMessageId = lane.stream?.messageId();
|
|
2902
|
-
return finalizePreview(previewTargetAfterStop.previewMessageId, false, previewTargetAfterStop.hadPreviewMessage, typeof activePreviewMessageId === "number" && activePreviewMessageId !== previewTargetAfterStop.previewMessageId);
|
|
2903
|
-
};
|
|
2904
|
-
const consumeArchivedAnswerPreviewForFinal = async ({ lane, text, payload, previewButtons, canEditViaPreview }) => {
|
|
2905
|
-
const archivedPreview = params.archivedAnswerPreviews.shift();
|
|
2906
|
-
if (!archivedPreview) return;
|
|
2907
|
-
if (canEditViaPreview) {
|
|
2908
|
-
const finalized = await tryUpdatePreviewForLane({
|
|
2909
|
-
lane,
|
|
2910
|
-
laneName: "answer",
|
|
2911
|
-
text,
|
|
2912
|
-
previewButtons,
|
|
2913
|
-
stopBeforeEdit: false,
|
|
2914
|
-
skipRegressive: "existingOnly",
|
|
2915
|
-
context: "final",
|
|
2916
|
-
previewMessageId: archivedPreview.messageId,
|
|
2917
|
-
previewTextSnapshot: archivedPreview.textSnapshot
|
|
2918
|
-
});
|
|
2919
|
-
if (finalized === "edited") return result("preview-finalized", {
|
|
2920
|
-
content: text,
|
|
2921
|
-
messageId: archivedPreview.messageId
|
|
2922
|
-
});
|
|
2923
|
-
if (finalized === "regressive-skipped") return result("preview-finalized", {
|
|
2924
|
-
content: archivedPreview.textSnapshot,
|
|
2925
|
-
messageId: archivedPreview.messageId
|
|
2926
|
-
});
|
|
2927
|
-
if (finalized === "retained") {
|
|
2928
|
-
params.retainPreviewOnCleanupByLane.answer = true;
|
|
2929
|
-
return result("preview-retained");
|
|
2930
|
-
}
|
|
2931
|
-
}
|
|
2932
|
-
const delivered = await params.sendPayload(params.applyTextToPayload(payload, text));
|
|
2933
|
-
if (delivered || archivedPreview.deleteIfUnused !== false) try {
|
|
2934
|
-
await params.deletePreviewMessage(archivedPreview.messageId);
|
|
2935
|
-
} catch (err) {
|
|
2936
|
-
params.log(`telegram: archived answer preview cleanup failed (${archivedPreview.messageId}): ${String(err)}`);
|
|
2937
|
-
}
|
|
2938
|
-
return delivered ? result("sent") : result("skipped");
|
|
2939
|
-
};
|
|
2940
|
-
return async ({ laneName, text, payload, infoKind, previewButtons, allowPreviewUpdateForNonFinal = false }) => {
|
|
2941
|
-
const lane = params.lanes[laneName];
|
|
2942
|
-
const hasMedia = resolveSendableOutboundReplyParts(payload, { text }).hasMedia;
|
|
2943
|
-
const canEditViaPreview = !hasMedia && text.length > 0 && text.length <= params.draftMaxChars && !payload.isError;
|
|
2944
|
-
if (infoKind === "final") {
|
|
2945
|
-
if (params.activePreviewLifecycleByLane[laneName] === "transient") params.retainPreviewOnCleanupByLane[laneName] = false;
|
|
2946
|
-
if (laneName === "answer") {
|
|
2947
|
-
const archivedResult = await consumeArchivedAnswerPreviewForFinal({
|
|
2948
|
-
lane,
|
|
2949
|
-
text,
|
|
2950
|
-
payload,
|
|
2951
|
-
previewButtons,
|
|
2952
|
-
canEditViaPreview
|
|
2953
|
-
});
|
|
2954
|
-
if (archivedResult) return archivedResult;
|
|
2955
|
-
}
|
|
2956
|
-
if (canEditViaPreview && params.activePreviewLifecycleByLane[laneName] === "transient") {
|
|
2957
|
-
await params.flushDraftLane(lane);
|
|
2958
|
-
if (laneName === "answer") {
|
|
2959
|
-
const archivedResultAfterFlush = await consumeArchivedAnswerPreviewForFinal({
|
|
2960
|
-
lane,
|
|
2961
|
-
text,
|
|
2962
|
-
payload,
|
|
2963
|
-
previewButtons,
|
|
2964
|
-
canEditViaPreview
|
|
2965
|
-
});
|
|
2966
|
-
if (archivedResultAfterFlush) return archivedResultAfterFlush;
|
|
2967
|
-
}
|
|
2968
|
-
if (canMaterializeDraftFinal(lane, previewButtons)) {
|
|
2969
|
-
const materializedMessageId = await tryMaterializeDraftPreviewForFinal({
|
|
2970
|
-
lane,
|
|
2971
|
-
laneName,
|
|
2972
|
-
text
|
|
2973
|
-
});
|
|
2974
|
-
if (typeof materializedMessageId === "number") {
|
|
2975
|
-
markActivePreviewComplete(laneName);
|
|
2976
|
-
return result("preview-finalized", {
|
|
2977
|
-
content: text,
|
|
2978
|
-
messageId: materializedMessageId
|
|
2979
|
-
});
|
|
2980
|
-
}
|
|
2981
|
-
}
|
|
2982
|
-
const previewMessageId = lane.stream?.messageId();
|
|
2983
|
-
const finalized = await tryUpdatePreviewForLane({
|
|
2984
|
-
lane,
|
|
2985
|
-
laneName,
|
|
2986
|
-
text,
|
|
2987
|
-
previewButtons,
|
|
2988
|
-
stopBeforeEdit: true,
|
|
2989
|
-
skipRegressive: "existingOnly",
|
|
2990
|
-
context: "final"
|
|
2991
|
-
});
|
|
2992
|
-
if (finalized === "edited") {
|
|
2993
|
-
markActivePreviewComplete(laneName);
|
|
2994
|
-
return result("preview-finalized", {
|
|
2995
|
-
content: text,
|
|
2996
|
-
messageId: previewMessageId ?? lane.stream?.messageId()
|
|
2997
|
-
});
|
|
2998
|
-
}
|
|
2999
|
-
if (finalized === "regressive-skipped") {
|
|
3000
|
-
markActivePreviewComplete(laneName);
|
|
3001
|
-
return result("preview-finalized", {
|
|
3002
|
-
content: lane.lastPartialText,
|
|
3003
|
-
messageId: previewMessageId ?? lane.stream?.messageId()
|
|
3004
|
-
});
|
|
3005
|
-
}
|
|
3006
|
-
if (finalized === "retained") {
|
|
3007
|
-
markActivePreviewComplete(laneName);
|
|
3008
|
-
return result("preview-retained");
|
|
3009
|
-
}
|
|
3010
|
-
} else if (!hasMedia && !payload.isError && text.length > params.draftMaxChars) params.log(`telegram: preview final too long for edit (${text.length} > ${params.draftMaxChars}); falling back to standard send`);
|
|
3011
|
-
await params.stopDraftLane(lane);
|
|
3012
|
-
return await params.sendPayload(params.applyTextToPayload(payload, text)) ? result("sent") : result("skipped");
|
|
3013
|
-
}
|
|
3014
|
-
if (allowPreviewUpdateForNonFinal && canEditViaPreview) {
|
|
3015
|
-
if (isDraftPreviewLane(lane)) {
|
|
3016
|
-
const previewRevisionBeforeFlush = lane.stream?.previewRevision?.() ?? 0;
|
|
3017
|
-
lane.stream?.update(text);
|
|
3018
|
-
await params.flushDraftLane(lane);
|
|
3019
|
-
if (!((lane.stream?.previewRevision?.() ?? 0) > previewRevisionBeforeFlush)) {
|
|
3020
|
-
params.log(`telegram: ${laneName} draft preview update not emitted; falling back to standard send`);
|
|
3021
|
-
return await params.sendPayload(params.applyTextToPayload(payload, text)) ? result("sent") : result("skipped");
|
|
3022
|
-
}
|
|
3023
|
-
lane.lastPartialText = text;
|
|
3024
|
-
params.markDelivered();
|
|
3025
|
-
return result("preview-updated");
|
|
3026
|
-
}
|
|
3027
|
-
const updated = await tryUpdatePreviewForLane({
|
|
3028
|
-
lane,
|
|
3029
|
-
laneName,
|
|
3030
|
-
text,
|
|
3031
|
-
previewButtons,
|
|
3032
|
-
stopBeforeEdit: false,
|
|
3033
|
-
updateLaneSnapshot: true,
|
|
3034
|
-
skipRegressive: "always",
|
|
3035
|
-
context: "update"
|
|
3036
|
-
});
|
|
3037
|
-
if (updated === "edited" || updated === "regressive-skipped") return result("preview-updated");
|
|
3038
|
-
}
|
|
3039
|
-
return await params.sendPayload(params.applyTextToPayload(payload, text)) ? result("sent") : result("skipped");
|
|
3040
|
-
};
|
|
3041
|
-
}
|
|
3042
|
-
//#endregion
|
|
3043
|
-
//#region extensions/telegram/src/lane-delivery-state.ts
|
|
3044
|
-
function createLaneDeliveryStateTracker() {
|
|
3045
|
-
const state = {
|
|
3046
|
-
delivered: false,
|
|
3047
|
-
skippedNonSilent: 0,
|
|
3048
|
-
failedNonSilent: 0
|
|
3049
|
-
};
|
|
3050
|
-
return {
|
|
3051
|
-
markDelivered: () => {
|
|
3052
|
-
state.delivered = true;
|
|
3053
|
-
},
|
|
3054
|
-
markNonSilentSkip: () => {
|
|
3055
|
-
state.skippedNonSilent += 1;
|
|
3056
|
-
},
|
|
3057
|
-
markNonSilentFailure: () => {
|
|
3058
|
-
state.failedNonSilent += 1;
|
|
3059
|
-
},
|
|
3060
|
-
snapshot: () => ({ ...state })
|
|
3061
|
-
};
|
|
3062
|
-
}
|
|
3063
|
-
//#endregion
|
|
3064
|
-
//#region extensions/telegram/src/reasoning-lane-coordinator.ts
|
|
3065
|
-
const REASONING_MESSAGE_PREFIX = "Reasoning:\n";
|
|
3066
|
-
const REASONING_TAG_PREFIXES = [
|
|
3067
|
-
"<think",
|
|
3068
|
-
"<thinking",
|
|
3069
|
-
"<thought",
|
|
3070
|
-
"<antthinking",
|
|
3071
|
-
"</think",
|
|
3072
|
-
"</thinking",
|
|
3073
|
-
"</thought",
|
|
3074
|
-
"</antthinking"
|
|
3075
|
-
];
|
|
3076
|
-
const THINKING_TAG_RE = /<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;
|
|
3077
|
-
function extractThinkingFromTaggedStreamOutsideCode(text) {
|
|
3078
|
-
if (!text) return "";
|
|
3079
|
-
const codeRegions = findCodeRegions(text);
|
|
3080
|
-
let result = "";
|
|
3081
|
-
let lastIndex = 0;
|
|
3082
|
-
let inThinking = false;
|
|
3083
|
-
THINKING_TAG_RE.lastIndex = 0;
|
|
3084
|
-
for (const match of text.matchAll(THINKING_TAG_RE)) {
|
|
3085
|
-
const idx = match.index ?? 0;
|
|
3086
|
-
if (isInsideCode(idx, codeRegions)) continue;
|
|
3087
|
-
if (inThinking) result += text.slice(lastIndex, idx);
|
|
3088
|
-
inThinking = !(match[1] === "/");
|
|
3089
|
-
lastIndex = idx + match[0].length;
|
|
3090
|
-
}
|
|
3091
|
-
if (inThinking) result += text.slice(lastIndex);
|
|
3092
|
-
return result.trim();
|
|
3093
|
-
}
|
|
3094
|
-
function isPartialReasoningTagPrefix(text) {
|
|
3095
|
-
const trimmed = text.trimStart().toLowerCase();
|
|
3096
|
-
if (!trimmed.startsWith("<")) return false;
|
|
3097
|
-
if (trimmed.includes(">")) return false;
|
|
3098
|
-
return REASONING_TAG_PREFIXES.some((prefix) => prefix.startsWith(trimmed));
|
|
3099
|
-
}
|
|
3100
|
-
function splitTelegramReasoningText(text) {
|
|
3101
|
-
if (typeof text !== "string") return {};
|
|
3102
|
-
const trimmed = text.trim();
|
|
3103
|
-
if (isPartialReasoningTagPrefix(trimmed)) return {};
|
|
3104
|
-
if (trimmed.startsWith(REASONING_MESSAGE_PREFIX) && trimmed.length > 11) return { reasoningText: trimmed };
|
|
3105
|
-
const taggedReasoning = extractThinkingFromTaggedStreamOutsideCode(text);
|
|
3106
|
-
const strippedAnswer = stripReasoningTagsFromText(text, {
|
|
3107
|
-
mode: "strict",
|
|
3108
|
-
trim: "both"
|
|
3109
|
-
});
|
|
3110
|
-
if (!taggedReasoning && strippedAnswer === text) return { answerText: text };
|
|
3111
|
-
return {
|
|
3112
|
-
reasoningText: taggedReasoning ? formatReasoningMessage(taggedReasoning) : void 0,
|
|
3113
|
-
answerText: strippedAnswer || void 0
|
|
3114
|
-
};
|
|
3115
|
-
}
|
|
3116
|
-
function createTelegramReasoningStepState() {
|
|
3117
|
-
let reasoningStatus = "none";
|
|
3118
|
-
let bufferedFinalAnswer;
|
|
3119
|
-
const noteReasoningHint = () => {
|
|
3120
|
-
if (reasoningStatus === "none") reasoningStatus = "hinted";
|
|
3121
|
-
};
|
|
3122
|
-
const noteReasoningDelivered = () => {
|
|
3123
|
-
reasoningStatus = "delivered";
|
|
3124
|
-
};
|
|
3125
|
-
const shouldBufferFinalAnswer = () => {
|
|
3126
|
-
return reasoningStatus === "hinted" && !bufferedFinalAnswer;
|
|
3127
|
-
};
|
|
3128
|
-
const bufferFinalAnswer = (value) => {
|
|
3129
|
-
bufferedFinalAnswer = value;
|
|
3130
|
-
};
|
|
3131
|
-
const takeBufferedFinalAnswer = () => {
|
|
3132
|
-
const value = bufferedFinalAnswer;
|
|
3133
|
-
bufferedFinalAnswer = void 0;
|
|
3134
|
-
return value;
|
|
3135
|
-
};
|
|
3136
|
-
const resetForNextStep = () => {
|
|
3137
|
-
reasoningStatus = "none";
|
|
3138
|
-
bufferedFinalAnswer = void 0;
|
|
3139
|
-
};
|
|
3140
|
-
return {
|
|
3141
|
-
noteReasoningHint,
|
|
3142
|
-
noteReasoningDelivered,
|
|
3143
|
-
shouldBufferFinalAnswer,
|
|
3144
|
-
bufferFinalAnswer,
|
|
3145
|
-
takeBufferedFinalAnswer,
|
|
3146
|
-
resetForNextStep
|
|
3147
|
-
};
|
|
3148
|
-
}
|
|
3149
|
-
//#endregion
|
|
3150
|
-
//#region extensions/telegram/src/bot-message-dispatch.ts
|
|
3151
|
-
const EMPTY_RESPONSE_FALLBACK = "No response generated. Please try again.";
|
|
3152
|
-
/** Minimum chars before sending first streaming message (improves push notification UX) */
|
|
3153
|
-
const DRAFT_MIN_INITIAL_CHARS = 30;
|
|
3154
|
-
async function resolveStickerVisionSupport(cfg, agentId) {
|
|
3155
|
-
try {
|
|
3156
|
-
const catalog = await loadModelCatalog({ config: cfg });
|
|
3157
|
-
const defaultModel = resolveDefaultModelForAgent({
|
|
3158
|
-
cfg,
|
|
3159
|
-
agentId
|
|
3160
|
-
});
|
|
3161
|
-
const entry = findModelInCatalog(catalog, defaultModel.provider, defaultModel.model);
|
|
3162
|
-
if (!entry) return false;
|
|
3163
|
-
return modelSupportsVision(entry);
|
|
3164
|
-
} catch {
|
|
3165
|
-
return false;
|
|
3166
|
-
}
|
|
3167
|
-
}
|
|
3168
|
-
function pruneStickerMediaFromContext(ctxPayload, opts) {
|
|
3169
|
-
if (opts?.stickerMediaIncluded === false) return;
|
|
3170
|
-
const nextMediaPaths = Array.isArray(ctxPayload.MediaPaths) ? ctxPayload.MediaPaths.slice(1) : void 0;
|
|
3171
|
-
const nextMediaUrls = Array.isArray(ctxPayload.MediaUrls) ? ctxPayload.MediaUrls.slice(1) : void 0;
|
|
3172
|
-
const nextMediaTypes = Array.isArray(ctxPayload.MediaTypes) ? ctxPayload.MediaTypes.slice(1) : void 0;
|
|
3173
|
-
ctxPayload.MediaPaths = nextMediaPaths && nextMediaPaths.length > 0 ? nextMediaPaths : void 0;
|
|
3174
|
-
ctxPayload.MediaUrls = nextMediaUrls && nextMediaUrls.length > 0 ? nextMediaUrls : void 0;
|
|
3175
|
-
ctxPayload.MediaTypes = nextMediaTypes && nextMediaTypes.length > 0 ? nextMediaTypes : void 0;
|
|
3176
|
-
ctxPayload.MediaPath = ctxPayload.MediaPaths?.[0];
|
|
3177
|
-
ctxPayload.MediaUrl = ctxPayload.MediaUrls?.[0] ?? ctxPayload.MediaPath;
|
|
3178
|
-
ctxPayload.MediaType = ctxPayload.MediaTypes?.[0];
|
|
3179
|
-
}
|
|
3180
|
-
function resolveTelegramReasoningLevel(params) {
|
|
3181
|
-
const { cfg, sessionKey, agentId, telegramDeps } = params;
|
|
3182
|
-
if (!sessionKey) return "off";
|
|
3183
|
-
try {
|
|
3184
|
-
const storePath = telegramDeps.resolveStorePath(cfg.session?.store, { agentId });
|
|
3185
|
-
const level = resolveSessionStoreEntry({
|
|
3186
|
-
store: (telegramDeps.loadSessionStore ?? loadSessionStore)(storePath, { skipCache: true }),
|
|
3187
|
-
sessionKey
|
|
3188
|
-
}).existing?.reasoningLevel;
|
|
3189
|
-
if (level === "on" || level === "stream") return level;
|
|
3190
|
-
} catch {}
|
|
3191
|
-
return "off";
|
|
3192
|
-
}
|
|
3193
|
-
const dispatchTelegramMessage = async ({ context, bot, cfg, runtime, replyToMode, streamMode, textLimit, telegramCfg, telegramDeps = defaultTelegramBotDeps, opts }) => {
|
|
3194
|
-
const { ctxPayload, msg, chatId, isGroup, groupConfig, topicConfig, threadSpec, historyKey, historyLimit, groupHistories, route, skillFilter, sendTyping, sendRecordVoice, ackReactionPromise, reactionApi, removeAckAfterReply, statusReactionController } = context;
|
|
3195
|
-
const draftMaxChars = Math.min(textLimit, 4096);
|
|
3196
|
-
const tableMode = resolveMarkdownTableMode({
|
|
3197
|
-
cfg,
|
|
3198
|
-
channel: "telegram",
|
|
3199
|
-
accountId: route.accountId
|
|
3200
|
-
});
|
|
3201
|
-
const renderDraftPreview = (text) => ({
|
|
3202
|
-
text: renderTelegramHtmlText(text, { tableMode }),
|
|
3203
|
-
parseMode: "HTML"
|
|
3204
|
-
});
|
|
3205
|
-
const accountBlockStreamingEnabled = typeof telegramCfg.blockStreaming === "boolean" ? telegramCfg.blockStreaming : cfg.agents?.defaults?.blockStreamingDefault === "on";
|
|
3206
|
-
const resolvedReasoningLevel = resolveTelegramReasoningLevel({
|
|
3207
|
-
cfg,
|
|
3208
|
-
sessionKey: ctxPayload.SessionKey,
|
|
3209
|
-
agentId: route.agentId,
|
|
3210
|
-
telegramDeps
|
|
3211
|
-
});
|
|
3212
|
-
const forceBlockStreamingForReasoning = resolvedReasoningLevel === "on";
|
|
3213
|
-
const streamReasoningDraft = resolvedReasoningLevel === "stream";
|
|
3214
|
-
const previewStreamingEnabled = streamMode !== "off";
|
|
3215
|
-
const canStreamAnswerDraft = previewStreamingEnabled && !accountBlockStreamingEnabled && !forceBlockStreamingForReasoning;
|
|
3216
|
-
const canStreamReasoningDraft = canStreamAnswerDraft || streamReasoningDraft;
|
|
3217
|
-
const draftReplyToMessageId = replyToMode !== "off" && typeof msg.message_id === "number" ? msg.message_id : void 0;
|
|
3218
|
-
const draftMinInitialChars = DRAFT_MIN_INITIAL_CHARS;
|
|
3219
|
-
const useMessagePreviewTransportForDm = threadSpec?.scope === "dm" && canStreamAnswerDraft;
|
|
3220
|
-
const mediaLocalRoots = getAgentScopedMediaLocalRoots(cfg, route.agentId);
|
|
3221
|
-
const archivedAnswerPreviews = [];
|
|
3222
|
-
const archivedReasoningPreviewIds = [];
|
|
3223
|
-
const createDraftLane = (laneName, enabled) => {
|
|
3224
|
-
return {
|
|
3225
|
-
stream: enabled ? (telegramDeps.createTelegramDraftStream ?? createTelegramDraftStream)({
|
|
3226
|
-
api: bot.api,
|
|
3227
|
-
chatId,
|
|
3228
|
-
maxChars: draftMaxChars,
|
|
3229
|
-
thread: threadSpec,
|
|
3230
|
-
previewTransport: useMessagePreviewTransportForDm ? "message" : "auto",
|
|
3231
|
-
replyToMessageId: draftReplyToMessageId,
|
|
3232
|
-
minInitialChars: draftMinInitialChars,
|
|
3233
|
-
renderText: renderDraftPreview,
|
|
3234
|
-
onSupersededPreview: laneName === "answer" || laneName === "reasoning" ? (preview) => {
|
|
3235
|
-
if (laneName === "reasoning") {
|
|
3236
|
-
if (!archivedReasoningPreviewIds.includes(preview.messageId)) archivedReasoningPreviewIds.push(preview.messageId);
|
|
3237
|
-
return;
|
|
3238
|
-
}
|
|
3239
|
-
archivedAnswerPreviews.push({
|
|
3240
|
-
messageId: preview.messageId,
|
|
3241
|
-
textSnapshot: preview.textSnapshot,
|
|
3242
|
-
deleteIfUnused: true
|
|
3243
|
-
});
|
|
3244
|
-
} : void 0,
|
|
3245
|
-
log: logVerbose,
|
|
3246
|
-
warn: logVerbose
|
|
3247
|
-
}) : void 0,
|
|
3248
|
-
lastPartialText: "",
|
|
3249
|
-
hasStreamedMessage: false
|
|
3250
|
-
};
|
|
3251
|
-
};
|
|
3252
|
-
const lanes = {
|
|
3253
|
-
answer: createDraftLane("answer", canStreamAnswerDraft),
|
|
3254
|
-
reasoning: createDraftLane("reasoning", canStreamReasoningDraft)
|
|
3255
|
-
};
|
|
3256
|
-
const activePreviewLifecycleByLane = {
|
|
3257
|
-
answer: "transient",
|
|
3258
|
-
reasoning: "transient"
|
|
3259
|
-
};
|
|
3260
|
-
const retainPreviewOnCleanupByLane = {
|
|
3261
|
-
answer: false,
|
|
3262
|
-
reasoning: false
|
|
3263
|
-
};
|
|
3264
|
-
const answerLane = lanes.answer;
|
|
3265
|
-
const reasoningLane = lanes.reasoning;
|
|
3266
|
-
let splitReasoningOnNextStream = false;
|
|
3267
|
-
let skipNextAnswerMessageStartRotation = false;
|
|
3268
|
-
let draftLaneEventQueue = Promise.resolve();
|
|
3269
|
-
const reasoningStepState = createTelegramReasoningStepState();
|
|
3270
|
-
const enqueueDraftLaneEvent = (task) => {
|
|
3271
|
-
draftLaneEventQueue = draftLaneEventQueue.then(task).catch((err) => {
|
|
3272
|
-
logVerbose(`telegram: draft lane callback failed: ${String(err)}`);
|
|
3273
|
-
});
|
|
3274
|
-
return draftLaneEventQueue;
|
|
3275
|
-
};
|
|
3276
|
-
const splitTextIntoLaneSegments = (text) => {
|
|
3277
|
-
const split = splitTelegramReasoningText(text);
|
|
3278
|
-
const segments = [];
|
|
3279
|
-
const suppressReasoning = resolvedReasoningLevel === "off";
|
|
3280
|
-
if (split.reasoningText && !suppressReasoning) segments.push({
|
|
3281
|
-
lane: "reasoning",
|
|
3282
|
-
text: split.reasoningText
|
|
3283
|
-
});
|
|
3284
|
-
if (split.answerText) segments.push({
|
|
3285
|
-
lane: "answer",
|
|
3286
|
-
text: split.answerText
|
|
3287
|
-
});
|
|
3288
|
-
return {
|
|
3289
|
-
segments,
|
|
3290
|
-
suppressedReasoningOnly: Boolean(split.reasoningText) && suppressReasoning && !split.answerText
|
|
3291
|
-
};
|
|
3292
|
-
};
|
|
3293
|
-
const resetDraftLaneState = (lane) => {
|
|
3294
|
-
lane.lastPartialText = "";
|
|
3295
|
-
lane.hasStreamedMessage = false;
|
|
3296
|
-
};
|
|
3297
|
-
const rotateAnswerLaneForNewAssistantMessage = async () => {
|
|
3298
|
-
let didForceNewMessage = false;
|
|
3299
|
-
if (answerLane.hasStreamedMessage) {
|
|
3300
|
-
const previewMessageId = await answerLane.stream?.materialize?.() ?? answerLane.stream?.messageId();
|
|
3301
|
-
if (typeof previewMessageId === "number" && activePreviewLifecycleByLane.answer === "transient") archivedAnswerPreviews.push({
|
|
3302
|
-
messageId: previewMessageId,
|
|
3303
|
-
textSnapshot: answerLane.lastPartialText,
|
|
3304
|
-
deleteIfUnused: false
|
|
3305
|
-
});
|
|
3306
|
-
answerLane.stream?.forceNewMessage();
|
|
3307
|
-
didForceNewMessage = true;
|
|
3308
|
-
}
|
|
3309
|
-
resetDraftLaneState(answerLane);
|
|
3310
|
-
if (didForceNewMessage) {
|
|
3311
|
-
activePreviewLifecycleByLane.answer = "transient";
|
|
3312
|
-
retainPreviewOnCleanupByLane.answer = false;
|
|
3313
|
-
}
|
|
3314
|
-
return didForceNewMessage;
|
|
3315
|
-
};
|
|
3316
|
-
const updateDraftFromPartial = (lane, text) => {
|
|
3317
|
-
const laneStream = lane.stream;
|
|
3318
|
-
if (!laneStream || !text) return;
|
|
3319
|
-
if (text === lane.lastPartialText) return;
|
|
3320
|
-
lane.hasStreamedMessage = true;
|
|
3321
|
-
if (lane.lastPartialText && lane.lastPartialText.startsWith(text) && text.length < lane.lastPartialText.length) return;
|
|
3322
|
-
lane.lastPartialText = text;
|
|
3323
|
-
laneStream.update(text);
|
|
3324
|
-
};
|
|
3325
|
-
const ingestDraftLaneSegments = async (text) => {
|
|
3326
|
-
const split = splitTextIntoLaneSegments(text);
|
|
3327
|
-
if (split.segments.some((segment) => segment.lane === "answer") && activePreviewLifecycleByLane.answer !== "transient") skipNextAnswerMessageStartRotation = await rotateAnswerLaneForNewAssistantMessage();
|
|
3328
|
-
for (const segment of split.segments) {
|
|
3329
|
-
if (segment.lane === "reasoning") {
|
|
3330
|
-
reasoningStepState.noteReasoningHint();
|
|
3331
|
-
reasoningStepState.noteReasoningDelivered();
|
|
3332
|
-
}
|
|
3333
|
-
updateDraftFromPartial(lanes[segment.lane], segment.text);
|
|
3334
|
-
}
|
|
3335
|
-
};
|
|
3336
|
-
const flushDraftLane = async (lane) => {
|
|
3337
|
-
if (!lane.stream) return;
|
|
3338
|
-
await lane.stream.flush();
|
|
3339
|
-
};
|
|
3340
|
-
const disableBlockStreaming = !previewStreamingEnabled ? true : forceBlockStreamingForReasoning ? false : typeof telegramCfg.blockStreaming === "boolean" ? !telegramCfg.blockStreaming : canStreamAnswerDraft ? true : void 0;
|
|
3341
|
-
const chunkMode = resolveChunkMode(cfg, "telegram", route.accountId);
|
|
3342
|
-
const sticker = ctxPayload.Sticker;
|
|
3343
|
-
if (sticker?.fileId && sticker.fileUniqueId && ctxPayload.MediaPath) {
|
|
3344
|
-
const agentDir = resolveAgentDir(cfg, route.agentId);
|
|
3345
|
-
const stickerSupportsVision = await resolveStickerVisionSupport(cfg, route.agentId);
|
|
3346
|
-
let description = sticker.cachedDescription ?? null;
|
|
3347
|
-
if (!description) description = await describeStickerImage({
|
|
3348
|
-
imagePath: ctxPayload.MediaPath,
|
|
3349
|
-
cfg,
|
|
3350
|
-
agentDir,
|
|
3351
|
-
agentId: route.agentId
|
|
3352
|
-
});
|
|
3353
|
-
if (description) {
|
|
3354
|
-
const stickerContext = [sticker.emoji, sticker.setName ? `from "${sticker.setName}"` : null].filter(Boolean).join(" ");
|
|
3355
|
-
const formattedDesc = `[Sticker${stickerContext ? ` ${stickerContext}` : ""}] ${description}`;
|
|
3356
|
-
sticker.cachedDescription = description;
|
|
3357
|
-
if (!stickerSupportsVision) {
|
|
3358
|
-
ctxPayload.Body = formattedDesc;
|
|
3359
|
-
ctxPayload.BodyForAgent = formattedDesc;
|
|
3360
|
-
pruneStickerMediaFromContext(ctxPayload, { stickerMediaIncluded: ctxPayload.StickerMediaIncluded });
|
|
3361
|
-
}
|
|
3362
|
-
if (sticker.fileId) {
|
|
3363
|
-
cacheSticker({
|
|
3364
|
-
fileId: sticker.fileId,
|
|
3365
|
-
fileUniqueId: sticker.fileUniqueId,
|
|
3366
|
-
emoji: sticker.emoji,
|
|
3367
|
-
setName: sticker.setName,
|
|
3368
|
-
description,
|
|
3369
|
-
cachedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3370
|
-
receivedFrom: ctxPayload.From
|
|
3371
|
-
});
|
|
3372
|
-
logVerbose(`telegram: cached sticker description for ${sticker.fileUniqueId}`);
|
|
3373
|
-
} else logVerbose(`telegram: skipped sticker cache (missing fileId)`);
|
|
3374
|
-
}
|
|
3375
|
-
}
|
|
3376
|
-
const replyQuoteText = ctxPayload.ReplyToIsQuote && ctxPayload.ReplyToBody ? ctxPayload.ReplyToBody.trim() || void 0 : void 0;
|
|
3377
|
-
const deliveryState = createLaneDeliveryStateTracker();
|
|
3378
|
-
const clearGroupHistory = () => {
|
|
3379
|
-
if (isGroup && historyKey) clearHistoryEntriesIfEnabled({
|
|
3380
|
-
historyMap: groupHistories,
|
|
3381
|
-
historyKey,
|
|
3382
|
-
limit: historyLimit
|
|
3383
|
-
});
|
|
3384
|
-
};
|
|
3385
|
-
const deliveryBaseOptions = {
|
|
3386
|
-
chatId: String(chatId),
|
|
3387
|
-
accountId: route.accountId,
|
|
3388
|
-
sessionKeyForInternalHooks: ctxPayload.SessionKey,
|
|
3389
|
-
mirrorIsGroup: isGroup,
|
|
3390
|
-
mirrorGroupId: isGroup ? String(chatId) : void 0,
|
|
3391
|
-
token: opts.token,
|
|
3392
|
-
runtime,
|
|
3393
|
-
bot,
|
|
3394
|
-
mediaLocalRoots,
|
|
3395
|
-
replyToMode,
|
|
3396
|
-
textLimit,
|
|
3397
|
-
thread: threadSpec,
|
|
3398
|
-
tableMode,
|
|
3399
|
-
chunkMode,
|
|
3400
|
-
linkPreview: telegramCfg.linkPreview,
|
|
3401
|
-
replyQuoteText
|
|
3402
|
-
};
|
|
3403
|
-
const silentErrorReplies = telegramCfg.silentErrorReplies === true;
|
|
3404
|
-
const applyTextToPayload = (payload, text) => {
|
|
3405
|
-
if (payload.text === text) return payload;
|
|
3406
|
-
return {
|
|
3407
|
-
...payload,
|
|
3408
|
-
text
|
|
3409
|
-
};
|
|
3410
|
-
};
|
|
3411
|
-
const sendPayload = async (payload) => {
|
|
3412
|
-
const result = await (telegramDeps.deliverReplies ?? deliverReplies)({
|
|
3413
|
-
...deliveryBaseOptions,
|
|
3414
|
-
replies: [payload],
|
|
3415
|
-
onVoiceRecording: sendRecordVoice,
|
|
3416
|
-
silent: silentErrorReplies && payload.isError === true,
|
|
3417
|
-
mediaLoader: telegramDeps.loadWebMedia
|
|
3418
|
-
});
|
|
3419
|
-
if (result.delivered) deliveryState.markDelivered();
|
|
3420
|
-
return result.delivered;
|
|
3421
|
-
};
|
|
3422
|
-
const emitPreviewFinalizedHook = (result) => {
|
|
3423
|
-
if (result.kind !== "preview-finalized") return;
|
|
3424
|
-
(telegramDeps.emitInternalMessageSentHook ?? emitInternalMessageSentHook)({
|
|
3425
|
-
sessionKeyForInternalHooks: deliveryBaseOptions.sessionKeyForInternalHooks,
|
|
3426
|
-
chatId: deliveryBaseOptions.chatId,
|
|
3427
|
-
accountId: deliveryBaseOptions.accountId,
|
|
3428
|
-
content: result.delivery.content,
|
|
3429
|
-
success: true,
|
|
3430
|
-
messageId: result.delivery.messageId,
|
|
3431
|
-
isGroup: deliveryBaseOptions.mirrorIsGroup,
|
|
3432
|
-
groupId: deliveryBaseOptions.mirrorGroupId
|
|
3433
|
-
});
|
|
3434
|
-
};
|
|
3435
|
-
const deliverLaneText = createLaneTextDeliverer({
|
|
3436
|
-
lanes,
|
|
3437
|
-
archivedAnswerPreviews,
|
|
3438
|
-
activePreviewLifecycleByLane,
|
|
3439
|
-
retainPreviewOnCleanupByLane,
|
|
3440
|
-
draftMaxChars,
|
|
3441
|
-
applyTextToPayload,
|
|
3442
|
-
sendPayload,
|
|
3443
|
-
flushDraftLane,
|
|
3444
|
-
stopDraftLane: async (lane) => {
|
|
3445
|
-
await lane.stream?.stop();
|
|
3446
|
-
},
|
|
3447
|
-
editPreview: async ({ messageId, text, previewButtons }) => {
|
|
3448
|
-
await (telegramDeps.editMessageTelegram ?? editMessageTelegram)(chatId, messageId, text, {
|
|
3449
|
-
api: bot.api,
|
|
3450
|
-
cfg,
|
|
3451
|
-
accountId: route.accountId,
|
|
3452
|
-
linkPreview: telegramCfg.linkPreview,
|
|
3453
|
-
buttons: previewButtons
|
|
3454
|
-
});
|
|
3455
|
-
},
|
|
3456
|
-
deletePreviewMessage: async (messageId) => {
|
|
3457
|
-
await bot.api.deleteMessage(chatId, messageId);
|
|
3458
|
-
},
|
|
3459
|
-
log: logVerbose,
|
|
3460
|
-
markDelivered: () => {
|
|
3461
|
-
deliveryState.markDelivered();
|
|
3462
|
-
}
|
|
3463
|
-
});
|
|
3464
|
-
let queuedFinal = false;
|
|
3465
|
-
let hadErrorReplyFailureOrSkip = false;
|
|
3466
|
-
const isDmTopic = !isGroup && threadSpec.scope === "dm" && threadSpec.id != null;
|
|
3467
|
-
let isFirstTurnInSession = false;
|
|
3468
|
-
if (isDmTopic) try {
|
|
3469
|
-
const storePath = telegramDeps.resolveStorePath(cfg.session?.store, { agentId: route.agentId });
|
|
3470
|
-
const store = (telegramDeps.loadSessionStore ?? loadSessionStore)(storePath, { skipCache: true });
|
|
3471
|
-
const sessionKey = ctxPayload.SessionKey;
|
|
3472
|
-
if (sessionKey) isFirstTurnInSession = !resolveSessionStoreEntry({
|
|
3473
|
-
store,
|
|
3474
|
-
sessionKey
|
|
3475
|
-
}).existing?.systemSent;
|
|
3476
|
-
else logVerbose("auto-topic-label: SessionKey is absent, skipping first-turn detection");
|
|
3477
|
-
} catch (err) {
|
|
3478
|
-
logVerbose(`auto-topic-label: session store error: ${err instanceof Error ? err.message : String(err)}`);
|
|
3479
|
-
}
|
|
3480
|
-
if (statusReactionController) statusReactionController.setThinking();
|
|
3481
|
-
const { onModelSelected, ...replyPipeline } = (telegramDeps.createChannelReplyPipeline ?? createChannelReplyPipeline)({
|
|
3482
|
-
cfg,
|
|
3483
|
-
agentId: route.agentId,
|
|
3484
|
-
channel: "telegram",
|
|
3485
|
-
accountId: route.accountId,
|
|
3486
|
-
typing: {
|
|
3487
|
-
start: sendTyping,
|
|
3488
|
-
onStartError: (err) => {
|
|
3489
|
-
logTypingFailure({
|
|
3490
|
-
log: logVerbose,
|
|
3491
|
-
channel: "telegram",
|
|
3492
|
-
target: String(chatId),
|
|
3493
|
-
error: err
|
|
3494
|
-
});
|
|
3495
|
-
}
|
|
3496
|
-
}
|
|
3497
|
-
});
|
|
3498
|
-
let dispatchError;
|
|
3499
|
-
try {
|
|
3500
|
-
({queuedFinal} = await telegramDeps.dispatchReplyWithBufferedBlockDispatcher({
|
|
3501
|
-
ctx: ctxPayload,
|
|
3502
|
-
cfg,
|
|
3503
|
-
dispatcherOptions: {
|
|
3504
|
-
...replyPipeline,
|
|
3505
|
-
deliver: async (payload, info) => {
|
|
3506
|
-
if (payload.isError === true) hadErrorReplyFailureOrSkip = true;
|
|
3507
|
-
if (info.kind === "final") await enqueueDraftLaneEvent(async () => {});
|
|
3508
|
-
if (shouldSuppressLocalTelegramExecApprovalPrompt({
|
|
3509
|
-
cfg,
|
|
3510
|
-
accountId: route.accountId,
|
|
3511
|
-
payload
|
|
3512
|
-
})) {
|
|
3513
|
-
queuedFinal = true;
|
|
3514
|
-
return;
|
|
3515
|
-
}
|
|
3516
|
-
const previewButtons = (payload.channelData?.telegram)?.buttons;
|
|
3517
|
-
const split = splitTextIntoLaneSegments(payload.text);
|
|
3518
|
-
const segments = split.segments;
|
|
3519
|
-
const reply = resolveSendableOutboundReplyParts(payload);
|
|
3520
|
-
reply.hasMedia;
|
|
3521
|
-
const flushBufferedFinalAnswer = async () => {
|
|
3522
|
-
const buffered = reasoningStepState.takeBufferedFinalAnswer();
|
|
3523
|
-
if (!buffered) return;
|
|
3524
|
-
const bufferedButtons = (buffered.payload.channelData?.telegram)?.buttons;
|
|
3525
|
-
await deliverLaneText({
|
|
3526
|
-
laneName: "answer",
|
|
3527
|
-
text: buffered.text,
|
|
3528
|
-
payload: buffered.payload,
|
|
3529
|
-
infoKind: "final",
|
|
3530
|
-
previewButtons: bufferedButtons
|
|
3531
|
-
});
|
|
3532
|
-
reasoningStepState.resetForNextStep();
|
|
3533
|
-
};
|
|
3534
|
-
for (const segment of segments) {
|
|
3535
|
-
if (segment.lane === "answer" && info.kind === "final" && reasoningStepState.shouldBufferFinalAnswer()) {
|
|
3536
|
-
reasoningStepState.bufferFinalAnswer({
|
|
3537
|
-
payload,
|
|
3538
|
-
text: segment.text
|
|
3539
|
-
});
|
|
3540
|
-
continue;
|
|
3541
|
-
}
|
|
3542
|
-
if (segment.lane === "reasoning") reasoningStepState.noteReasoningHint();
|
|
3543
|
-
const result = await deliverLaneText({
|
|
3544
|
-
laneName: segment.lane,
|
|
3545
|
-
text: segment.text,
|
|
3546
|
-
payload,
|
|
3547
|
-
infoKind: info.kind,
|
|
3548
|
-
previewButtons,
|
|
3549
|
-
allowPreviewUpdateForNonFinal: segment.lane === "reasoning"
|
|
3550
|
-
});
|
|
3551
|
-
if (info.kind === "final") emitPreviewFinalizedHook(result);
|
|
3552
|
-
if (segment.lane === "reasoning") {
|
|
3553
|
-
if (result.kind !== "skipped") {
|
|
3554
|
-
reasoningStepState.noteReasoningDelivered();
|
|
3555
|
-
await flushBufferedFinalAnswer();
|
|
3556
|
-
}
|
|
3557
|
-
continue;
|
|
3558
|
-
}
|
|
3559
|
-
if (info.kind === "final") {
|
|
3560
|
-
if (reasoningLane.hasStreamedMessage) {
|
|
3561
|
-
activePreviewLifecycleByLane.reasoning = "complete";
|
|
3562
|
-
retainPreviewOnCleanupByLane.reasoning = true;
|
|
3563
|
-
}
|
|
3564
|
-
reasoningStepState.resetForNextStep();
|
|
3565
|
-
}
|
|
3566
|
-
}
|
|
3567
|
-
if (segments.length > 0) return;
|
|
3568
|
-
if (split.suppressedReasoningOnly) {
|
|
3569
|
-
if (reply.hasMedia) await sendPayload(typeof payload.text === "string" ? {
|
|
3570
|
-
...payload,
|
|
3571
|
-
text: ""
|
|
3572
|
-
} : payload);
|
|
3573
|
-
if (info.kind === "final") await flushBufferedFinalAnswer();
|
|
3574
|
-
return;
|
|
3575
|
-
}
|
|
3576
|
-
if (info.kind === "final") {
|
|
3577
|
-
await answerLane.stream?.stop();
|
|
3578
|
-
await reasoningLane.stream?.stop();
|
|
3579
|
-
reasoningStepState.resetForNextStep();
|
|
3580
|
-
}
|
|
3581
|
-
if (!(reply.hasMedia || reply.text.length > 0)) {
|
|
3582
|
-
if (info.kind === "final") await flushBufferedFinalAnswer();
|
|
3583
|
-
return;
|
|
3584
|
-
}
|
|
3585
|
-
await sendPayload(payload);
|
|
3586
|
-
if (info.kind === "final") await flushBufferedFinalAnswer();
|
|
3587
|
-
},
|
|
3588
|
-
onSkip: (payload, info) => {
|
|
3589
|
-
if (payload.isError === true) hadErrorReplyFailureOrSkip = true;
|
|
3590
|
-
if (info.reason !== "silent") deliveryState.markNonSilentSkip();
|
|
3591
|
-
},
|
|
3592
|
-
onError: (err, info) => {
|
|
3593
|
-
const errorPolicy = resolveTelegramErrorPolicy({
|
|
3594
|
-
accountConfig: telegramCfg,
|
|
3595
|
-
groupConfig,
|
|
3596
|
-
topicConfig
|
|
3597
|
-
});
|
|
3598
|
-
if (isSilentErrorPolicy(errorPolicy.policy)) return;
|
|
3599
|
-
if (errorPolicy.policy === "once" && shouldSuppressTelegramError({
|
|
3600
|
-
scopeKey: buildTelegramErrorScopeKey({
|
|
3601
|
-
accountId: route.accountId,
|
|
3602
|
-
chatId,
|
|
3603
|
-
threadId: threadSpec.id
|
|
3604
|
-
}),
|
|
3605
|
-
cooldownMs: errorPolicy.cooldownMs,
|
|
3606
|
-
errorMessage: String(err)
|
|
3607
|
-
})) return;
|
|
3608
|
-
deliveryState.markNonSilentFailure();
|
|
3609
|
-
runtime.error?.(danger(`telegram ${info.kind} reply failed: ${String(err)}`));
|
|
3610
|
-
}
|
|
3611
|
-
},
|
|
3612
|
-
replyOptions: {
|
|
3613
|
-
skillFilter,
|
|
3614
|
-
disableBlockStreaming,
|
|
3615
|
-
onPartialReply: answerLane.stream || reasoningLane.stream ? (payload) => enqueueDraftLaneEvent(async () => {
|
|
3616
|
-
await ingestDraftLaneSegments(payload.text);
|
|
3617
|
-
}) : void 0,
|
|
3618
|
-
onReasoningStream: reasoningLane.stream ? (payload) => enqueueDraftLaneEvent(async () => {
|
|
3619
|
-
if (splitReasoningOnNextStream) {
|
|
3620
|
-
reasoningLane.stream?.forceNewMessage();
|
|
3621
|
-
resetDraftLaneState(reasoningLane);
|
|
3622
|
-
splitReasoningOnNextStream = false;
|
|
3623
|
-
}
|
|
3624
|
-
await ingestDraftLaneSegments(payload.text);
|
|
3625
|
-
}) : void 0,
|
|
3626
|
-
onAssistantMessageStart: answerLane.stream ? () => enqueueDraftLaneEvent(async () => {
|
|
3627
|
-
reasoningStepState.resetForNextStep();
|
|
3628
|
-
if (skipNextAnswerMessageStartRotation) {
|
|
3629
|
-
skipNextAnswerMessageStartRotation = false;
|
|
3630
|
-
activePreviewLifecycleByLane.answer = "transient";
|
|
3631
|
-
retainPreviewOnCleanupByLane.answer = false;
|
|
3632
|
-
return;
|
|
3633
|
-
}
|
|
3634
|
-
await rotateAnswerLaneForNewAssistantMessage();
|
|
3635
|
-
activePreviewLifecycleByLane.answer = "transient";
|
|
3636
|
-
retainPreviewOnCleanupByLane.answer = false;
|
|
3637
|
-
}) : void 0,
|
|
3638
|
-
onReasoningEnd: reasoningLane.stream ? () => enqueueDraftLaneEvent(async () => {
|
|
3639
|
-
splitReasoningOnNextStream = reasoningLane.hasStreamedMessage;
|
|
3640
|
-
}) : void 0,
|
|
3641
|
-
onToolStart: statusReactionController ? async (payload) => {
|
|
3642
|
-
await statusReactionController.setTool(payload.name);
|
|
3643
|
-
} : void 0,
|
|
3644
|
-
onCompactionStart: statusReactionController ? () => statusReactionController.setCompacting() : void 0,
|
|
3645
|
-
onCompactionEnd: statusReactionController ? async () => {
|
|
3646
|
-
statusReactionController.cancelPending();
|
|
3647
|
-
await statusReactionController.setThinking();
|
|
3648
|
-
} : void 0,
|
|
3649
|
-
onModelSelected
|
|
3650
|
-
}
|
|
3651
|
-
}));
|
|
3652
|
-
} catch (err) {
|
|
3653
|
-
dispatchError = err;
|
|
3654
|
-
runtime.error?.(danger(`telegram dispatch failed: ${String(err)}`));
|
|
3655
|
-
} finally {
|
|
3656
|
-
await draftLaneEventQueue;
|
|
3657
|
-
const streamCleanupStates = /* @__PURE__ */ new Map();
|
|
3658
|
-
const lanesToCleanup = [{
|
|
3659
|
-
laneName: "answer",
|
|
3660
|
-
lane: answerLane
|
|
3661
|
-
}, {
|
|
3662
|
-
laneName: "reasoning",
|
|
3663
|
-
lane: reasoningLane
|
|
3664
|
-
}];
|
|
3665
|
-
for (const laneState of lanesToCleanup) {
|
|
3666
|
-
const stream = laneState.lane.stream;
|
|
3667
|
-
if (!stream) continue;
|
|
3668
|
-
const activePreviewMessageId = stream.messageId();
|
|
3669
|
-
const hasBoundaryFinalizedActivePreview = laneState.laneName === "answer" && typeof activePreviewMessageId === "number" && archivedAnswerPreviews.some((p) => p.deleteIfUnused === false && p.messageId === activePreviewMessageId);
|
|
3670
|
-
const shouldClear = !retainPreviewOnCleanupByLane[laneState.laneName] && !hasBoundaryFinalizedActivePreview;
|
|
3671
|
-
const existing = streamCleanupStates.get(stream);
|
|
3672
|
-
if (!existing) {
|
|
3673
|
-
streamCleanupStates.set(stream, { shouldClear });
|
|
3674
|
-
continue;
|
|
3675
|
-
}
|
|
3676
|
-
existing.shouldClear = existing.shouldClear && shouldClear;
|
|
3677
|
-
}
|
|
3678
|
-
for (const [stream, cleanupState] of streamCleanupStates) {
|
|
3679
|
-
await stream.stop();
|
|
3680
|
-
if (cleanupState.shouldClear) await stream.clear();
|
|
3681
|
-
}
|
|
3682
|
-
for (const archivedPreview of archivedAnswerPreviews) {
|
|
3683
|
-
if (archivedPreview.deleteIfUnused === false) continue;
|
|
3684
|
-
try {
|
|
3685
|
-
await bot.api.deleteMessage(chatId, archivedPreview.messageId);
|
|
3686
|
-
} catch (err) {
|
|
3687
|
-
logVerbose(`telegram: archived answer preview cleanup failed (${archivedPreview.messageId}): ${String(err)}`);
|
|
3688
|
-
}
|
|
3689
|
-
}
|
|
3690
|
-
for (const messageId of archivedReasoningPreviewIds) try {
|
|
3691
|
-
await bot.api.deleteMessage(chatId, messageId);
|
|
3692
|
-
} catch (err) {
|
|
3693
|
-
logVerbose(`telegram: archived reasoning preview cleanup failed (${messageId}): ${String(err)}`);
|
|
3694
|
-
}
|
|
3695
|
-
}
|
|
3696
|
-
let sentFallback = false;
|
|
3697
|
-
const deliverySummary = deliveryState.snapshot();
|
|
3698
|
-
if (dispatchError || !deliverySummary.delivered && (deliverySummary.skippedNonSilent > 0 || deliverySummary.failedNonSilent > 0)) {
|
|
3699
|
-
const fallbackText = dispatchError ? "Something went wrong while processing your request. Please try again." : EMPTY_RESPONSE_FALLBACK;
|
|
3700
|
-
sentFallback = (await (telegramDeps.deliverReplies ?? deliverReplies)({
|
|
3701
|
-
replies: [{ text: fallbackText }],
|
|
3702
|
-
...deliveryBaseOptions,
|
|
3703
|
-
silent: silentErrorReplies && (dispatchError != null || hadErrorReplyFailureOrSkip),
|
|
3704
|
-
mediaLoader: telegramDeps.loadWebMedia
|
|
3705
|
-
})).delivered;
|
|
3706
|
-
}
|
|
3707
|
-
const hasFinalResponse = queuedFinal || sentFallback;
|
|
3708
|
-
if (statusReactionController && !hasFinalResponse) statusReactionController.setError().catch((err) => {
|
|
3709
|
-
logVerbose(`telegram: status reaction error finalize failed: ${String(err)}`);
|
|
3710
|
-
});
|
|
3711
|
-
if (!hasFinalResponse) {
|
|
3712
|
-
clearGroupHistory();
|
|
3713
|
-
return;
|
|
3714
|
-
}
|
|
3715
|
-
if (isDmTopic && isFirstTurnInSession) {
|
|
3716
|
-
const userMessage = (ctxPayload.RawBody ?? ctxPayload.Body ?? "").slice(0, 500);
|
|
3717
|
-
if (userMessage.trim()) {
|
|
3718
|
-
const agentDir = resolveAgentDir(cfg, route.agentId);
|
|
3719
|
-
const directAutoTopicLabel = (!isGroup ? groupConfig : void 0)?.autoTopicLabel;
|
|
3720
|
-
const accountAutoTopicLabel = telegramCfg?.autoTopicLabel;
|
|
3721
|
-
const autoTopicConfig = resolveAutoTopicLabelConfig(directAutoTopicLabel, accountAutoTopicLabel);
|
|
3722
|
-
if (autoTopicConfig) {
|
|
3723
|
-
const topicThreadId = threadSpec.id;
|
|
3724
|
-
(async () => {
|
|
3725
|
-
try {
|
|
3726
|
-
const label = await generateTopicLabel({
|
|
3727
|
-
userMessage,
|
|
3728
|
-
prompt: autoTopicConfig.prompt,
|
|
3729
|
-
cfg,
|
|
3730
|
-
agentId: route.agentId,
|
|
3731
|
-
agentDir
|
|
3732
|
-
});
|
|
3733
|
-
if (!label) {
|
|
3734
|
-
logVerbose("auto-topic-label: LLM returned empty label");
|
|
3735
|
-
return;
|
|
3736
|
-
}
|
|
3737
|
-
logVerbose(`auto-topic-label: generated label (len=${label.length})`);
|
|
3738
|
-
await bot.api.editForumTopic(chatId, topicThreadId, { name: label });
|
|
3739
|
-
logVerbose(`auto-topic-label: renamed topic ${chatId}/${topicThreadId}`);
|
|
3740
|
-
} catch (err) {
|
|
3741
|
-
logVerbose(`auto-topic-label: failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
3742
|
-
}
|
|
3743
|
-
})();
|
|
3744
|
-
}
|
|
3745
|
-
}
|
|
3746
|
-
}
|
|
3747
|
-
if (statusReactionController) statusReactionController.setDone().catch((err) => {
|
|
3748
|
-
logVerbose(`telegram: status reaction finalize failed: ${String(err)}`);
|
|
3749
|
-
});
|
|
3750
|
-
else removeAckReactionAfterReply({
|
|
3751
|
-
removeAfterReply: removeAckAfterReply,
|
|
3752
|
-
ackReactionPromise,
|
|
3753
|
-
ackReactionValue: ackReactionPromise ? "ack" : null,
|
|
3754
|
-
remove: () => (reactionApi?.(chatId, msg.message_id ?? 0, []) ?? Promise.resolve()).then(() => {}),
|
|
3755
|
-
onError: (err) => {
|
|
3756
|
-
if (!msg.message_id) return;
|
|
3757
|
-
logAckFailure({
|
|
3758
|
-
log: logVerbose,
|
|
3759
|
-
channel: "telegram",
|
|
3760
|
-
target: `${chatId}/${msg.message_id}`,
|
|
3761
|
-
error: err
|
|
3762
|
-
});
|
|
3763
|
-
}
|
|
3764
|
-
});
|
|
3765
|
-
clearGroupHistory();
|
|
3766
|
-
};
|
|
3767
|
-
//#endregion
|
|
3768
|
-
//#region extensions/telegram/src/bot-message.ts
|
|
3769
|
-
const createTelegramMessageProcessor = (deps) => {
|
|
3770
|
-
const { bot, cfg, account, telegramCfg, historyLimit, groupHistories, dmPolicy, allowFrom, groupAllowFrom, ackReactionScope, logger, resolveGroupActivation, resolveGroupRequireMention, resolveTelegramGroupConfig, loadFreshConfig, sendChatActionHandler, runtime, replyToMode, streamMode, textLimit, telegramDeps, opts } = deps;
|
|
3771
|
-
return async (primaryCtx, allMedia, storeAllowFrom, options, replyMedia) => {
|
|
3772
|
-
const ingressReceivedAtMs = typeof options?.receivedAtMs === "number" && Number.isFinite(options.receivedAtMs) ? options.receivedAtMs : void 0;
|
|
3773
|
-
const ingressDebugEnabled = shouldLogVerbose() || process.env.OPENCLAW_DEBUG_TELEGRAM_INGRESS === "1";
|
|
3774
|
-
const ingressContextStartMs = ingressReceivedAtMs ? Date.now() : void 0;
|
|
3775
|
-
const context = await buildTelegramMessageContext({
|
|
3776
|
-
primaryCtx,
|
|
3777
|
-
allMedia,
|
|
3778
|
-
replyMedia,
|
|
3779
|
-
storeAllowFrom,
|
|
3780
|
-
options,
|
|
3781
|
-
bot,
|
|
3782
|
-
cfg,
|
|
3783
|
-
account,
|
|
3784
|
-
historyLimit,
|
|
3785
|
-
groupHistories,
|
|
3786
|
-
dmPolicy,
|
|
3787
|
-
allowFrom,
|
|
3788
|
-
groupAllowFrom,
|
|
3789
|
-
ackReactionScope,
|
|
3790
|
-
logger,
|
|
3791
|
-
resolveGroupActivation,
|
|
3792
|
-
resolveGroupRequireMention,
|
|
3793
|
-
resolveTelegramGroupConfig,
|
|
3794
|
-
sendChatActionHandler,
|
|
3795
|
-
loadFreshConfig,
|
|
3796
|
-
upsertPairingRequest: telegramDeps.upsertChannelPairingRequest
|
|
3797
|
-
});
|
|
3798
|
-
if (!context) {
|
|
3799
|
-
if (ingressDebugEnabled && ingressReceivedAtMs && ingressContextStartMs) logVerbose(`telegram ingress: chatId=${primaryCtx.message.chat.id} dropped after ${Date.now() - ingressReceivedAtMs}ms${options?.ingressBuffer ? ` buffer=${options.ingressBuffer}` : ""}`);
|
|
3800
|
-
return;
|
|
3801
|
-
}
|
|
3802
|
-
if (ingressDebugEnabled && ingressReceivedAtMs && ingressContextStartMs) logVerbose(`telegram ingress: chatId=${context.chatId} contextReadyMs=${Date.now() - ingressReceivedAtMs} preDispatchMs=${Date.now() - ingressContextStartMs}${options?.ingressBuffer ? ` buffer=${options.ingressBuffer}` : ""}`);
|
|
3803
|
-
try {
|
|
3804
|
-
await dispatchTelegramMessage({
|
|
3805
|
-
context,
|
|
3806
|
-
bot,
|
|
3807
|
-
cfg,
|
|
3808
|
-
runtime,
|
|
3809
|
-
replyToMode,
|
|
3810
|
-
streamMode,
|
|
3811
|
-
textLimit,
|
|
3812
|
-
telegramCfg,
|
|
3813
|
-
telegramDeps,
|
|
3814
|
-
opts
|
|
3815
|
-
});
|
|
3816
|
-
if (ingressDebugEnabled && ingressReceivedAtMs) logVerbose(`telegram ingress: chatId=${context.chatId} dispatchCompleteMs=${Date.now() - ingressReceivedAtMs}${options?.ingressBuffer ? ` buffer=${options.ingressBuffer}` : ""}`);
|
|
3817
|
-
} catch (err) {
|
|
3818
|
-
runtime.error?.(danger(`telegram message processing failed: ${String(err)}`));
|
|
3819
|
-
try {
|
|
3820
|
-
await bot.api.sendMessage(context.chatId, "Something went wrong while processing your request. Please try again.", buildTelegramThreadParams(context.threadSpec));
|
|
3821
|
-
} catch {}
|
|
3822
|
-
}
|
|
3823
|
-
};
|
|
3824
|
-
};
|
|
3825
|
-
//#endregion
|
|
3826
|
-
//#region extensions/telegram/src/sendchataction-401-backoff.ts
|
|
3827
|
-
const BACKOFF_POLICY = {
|
|
3828
|
-
initialMs: 1e3,
|
|
3829
|
-
maxMs: 3e5,
|
|
3830
|
-
factor: 2,
|
|
3831
|
-
jitter: .1
|
|
3832
|
-
};
|
|
3833
|
-
function is401Error(error) {
|
|
3834
|
-
if (!error) return false;
|
|
3835
|
-
const message = error instanceof Error ? error.message : JSON.stringify(error);
|
|
3836
|
-
return message.includes("401") || message.toLowerCase().includes("unauthorized");
|
|
3837
|
-
}
|
|
3838
|
-
/**
|
|
3839
|
-
* Creates a GLOBAL (per-account) handler for sendChatAction that tracks 401 errors
|
|
3840
|
-
* across all message contexts. This prevents the infinite loop that caused Telegram
|
|
3841
|
-
* to delete bots (issue #27092).
|
|
3842
|
-
*
|
|
3843
|
-
* When a 401 occurs, exponential backoff is applied (1s → 2s → 4s → ... → 5min).
|
|
3844
|
-
* After maxConsecutive401 failures (default 10), all sendChatAction calls are
|
|
3845
|
-
* suspended until reset() is called.
|
|
3846
|
-
*/
|
|
3847
|
-
function createTelegramSendChatActionHandler({ sendChatActionFn, logger, maxConsecutive401 = 10 }) {
|
|
3848
|
-
let consecutive401Failures = 0;
|
|
3849
|
-
let suspended = false;
|
|
3850
|
-
const reset = () => {
|
|
3851
|
-
consecutive401Failures = 0;
|
|
3852
|
-
suspended = false;
|
|
3853
|
-
};
|
|
3854
|
-
const sendChatAction = async (chatId, action, threadParams) => {
|
|
3855
|
-
if (suspended) return;
|
|
3856
|
-
if (consecutive401Failures > 0) {
|
|
3857
|
-
const backoffMs = computeBackoff(BACKOFF_POLICY, consecutive401Failures);
|
|
3858
|
-
logger(`sendChatAction backoff: waiting ${backoffMs}ms before retry (failure ${consecutive401Failures}/${maxConsecutive401})`);
|
|
3859
|
-
await sleepWithAbort(backoffMs);
|
|
3860
|
-
}
|
|
3861
|
-
try {
|
|
3862
|
-
await sendChatActionFn(chatId, action, threadParams);
|
|
3863
|
-
if (consecutive401Failures > 0) {
|
|
3864
|
-
logger(`sendChatAction recovered after ${consecutive401Failures} consecutive 401 failures`);
|
|
3865
|
-
consecutive401Failures = 0;
|
|
3866
|
-
}
|
|
3867
|
-
} catch (error) {
|
|
3868
|
-
if (is401Error(error)) {
|
|
3869
|
-
consecutive401Failures++;
|
|
3870
|
-
if (consecutive401Failures >= maxConsecutive401) {
|
|
3871
|
-
suspended = true;
|
|
3872
|
-
logger(`CRITICAL: sendChatAction suspended after ${consecutive401Failures} consecutive 401 errors. Bot token is likely invalid. Telegram may DELETE the bot if requests continue. Replace the token and restart: openclaw channels restart telegram`);
|
|
3873
|
-
} else logger(`sendChatAction 401 error (${consecutive401Failures}/${maxConsecutive401}). Retrying with exponential backoff.`);
|
|
3874
|
-
}
|
|
3875
|
-
throw error;
|
|
3876
|
-
}
|
|
3877
|
-
};
|
|
3878
|
-
return {
|
|
3879
|
-
sendChatAction,
|
|
3880
|
-
isSuspended: () => suspended,
|
|
3881
|
-
reset
|
|
3882
|
-
};
|
|
3883
|
-
}
|
|
3884
|
-
//#endregion
|
|
3885
|
-
//#region extensions/telegram/src/sequential-key.ts
|
|
3886
|
-
function getTelegramSequentialKey(ctx) {
|
|
3887
|
-
const reaction = ctx.update?.message_reaction;
|
|
3888
|
-
if (reaction?.chat?.id) return `telegram:${reaction.chat.id}`;
|
|
3889
|
-
const msg = ctx.message ?? ctx.channelPost ?? ctx.editedChannelPost ?? ctx.update?.message ?? ctx.update?.edited_message ?? ctx.update?.channel_post ?? ctx.update?.edited_channel_post ?? ctx.update?.callback_query?.message;
|
|
3890
|
-
const chatId = msg?.chat?.id ?? ctx.chat?.id;
|
|
3891
|
-
const rawText = msg?.text ?? msg?.caption;
|
|
3892
|
-
const botUsername = ctx.me?.username;
|
|
3893
|
-
if (isAbortRequestText(rawText, botUsername ? { botUsername } : void 0)) {
|
|
3894
|
-
if (typeof chatId === "number") return `telegram:${chatId}:control`;
|
|
3895
|
-
return "telegram:control";
|
|
3896
|
-
}
|
|
3897
|
-
if (isBtwRequestText(rawText, botUsername ? { botUsername } : void 0)) {
|
|
3898
|
-
const messageId = msg?.message_id;
|
|
3899
|
-
if (typeof chatId === "number" && typeof messageId === "number") return `telegram:${chatId}:btw:${messageId}`;
|
|
3900
|
-
if (typeof chatId === "number") return `telegram:${chatId}:btw`;
|
|
3901
|
-
return "telegram:btw";
|
|
3902
|
-
}
|
|
3903
|
-
const isGroup = msg?.chat?.type === "group" || msg?.chat?.type === "supergroup";
|
|
3904
|
-
const messageThreadId = msg?.message_thread_id;
|
|
3905
|
-
const isForum = msg?.chat?.is_forum;
|
|
3906
|
-
const threadId = isGroup ? resolveTelegramForumThreadId({
|
|
3907
|
-
isForum,
|
|
3908
|
-
messageThreadId
|
|
3909
|
-
}) : messageThreadId;
|
|
3910
|
-
if (typeof chatId === "number") return threadId != null ? `telegram:${chatId}:topic:${threadId}` : `telegram:${chatId}`;
|
|
3911
|
-
return "telegram:unknown";
|
|
3912
|
-
}
|
|
3913
|
-
//#endregion
|
|
3914
|
-
//#region extensions/telegram/src/bot.ts
|
|
3915
|
-
const DEFAULT_TELEGRAM_BOT_RUNTIME = {
|
|
3916
|
-
Bot: Bot$1,
|
|
3917
|
-
sequentialize,
|
|
3918
|
-
apiThrottler
|
|
3919
|
-
};
|
|
3920
|
-
const TELEGRAM_GET_UPDATES_REQUEST_TIMEOUT_MS = 45e3;
|
|
3921
|
-
let telegramBotRuntimeForTest;
|
|
3922
|
-
function asTelegramClientFetch(fetchImpl) {
|
|
3923
|
-
return fetchImpl;
|
|
3924
|
-
}
|
|
3925
|
-
function asTelegramCompatFetch(fetchImpl) {
|
|
3926
|
-
return fetchImpl;
|
|
3927
|
-
}
|
|
3928
|
-
function readRequestUrl(input) {
|
|
3929
|
-
if (typeof input === "string") return input;
|
|
3930
|
-
if (input instanceof URL) return input.toString();
|
|
3931
|
-
if (input instanceof Request) return input.url;
|
|
3932
|
-
return null;
|
|
3933
|
-
}
|
|
3934
|
-
function extractTelegramApiMethod(input) {
|
|
3935
|
-
const url = readRequestUrl(input);
|
|
3936
|
-
if (!url) return null;
|
|
3937
|
-
try {
|
|
3938
|
-
const segments = new URL(url).pathname.split("/").filter(Boolean);
|
|
3939
|
-
return (segments.length > 0 ? segments.at(-1) ?? null : null)?.toLowerCase() ?? null;
|
|
3940
|
-
} catch {
|
|
3941
|
-
return null;
|
|
3942
|
-
}
|
|
3943
|
-
}
|
|
3944
|
-
function createTelegramBot(opts) {
|
|
3945
|
-
const botRuntime = telegramBotRuntimeForTest ?? DEFAULT_TELEGRAM_BOT_RUNTIME;
|
|
3946
|
-
const runtime = opts.runtime ?? createNonExitingRuntime();
|
|
3947
|
-
const telegramDeps = opts.telegramDeps ?? defaultTelegramBotDeps;
|
|
3948
|
-
const cfg = opts.config ?? telegramDeps.loadConfig();
|
|
3949
|
-
const account = resolveTelegramAccount({
|
|
3950
|
-
cfg,
|
|
3951
|
-
accountId: opts.accountId
|
|
3952
|
-
});
|
|
3953
|
-
const threadBindingManager = resolveThreadBindingSpawnPolicy({
|
|
3954
|
-
cfg,
|
|
3955
|
-
channel: "telegram",
|
|
3956
|
-
accountId: account.accountId,
|
|
3957
|
-
kind: "subagent"
|
|
3958
|
-
}).enabled ? createTelegramThreadBindingManager({
|
|
3959
|
-
accountId: account.accountId,
|
|
3960
|
-
idleTimeoutMs: resolveThreadBindingIdleTimeoutMsForChannel({
|
|
3961
|
-
cfg,
|
|
3962
|
-
channel: "telegram",
|
|
3963
|
-
accountId: account.accountId
|
|
3964
|
-
}),
|
|
3965
|
-
maxAgeMs: resolveThreadBindingMaxAgeMsForChannel({
|
|
3966
|
-
cfg,
|
|
3967
|
-
channel: "telegram",
|
|
3968
|
-
accountId: account.accountId
|
|
3969
|
-
})
|
|
3970
|
-
}) : null;
|
|
3971
|
-
const telegramCfg = account.config;
|
|
3972
|
-
const telegramTransport = opts.telegramTransport ?? resolveTelegramTransport(opts.proxyFetch, { network: telegramCfg.network });
|
|
3973
|
-
const shouldProvideFetch = Boolean(telegramTransport.fetch);
|
|
3974
|
-
const fetchForClient = telegramTransport.fetch ? asTelegramCompatFetch(asTelegramClientFetch(telegramTransport.fetch)) : void 0;
|
|
3975
|
-
let finalFetch = shouldProvideFetch ? fetchForClient : void 0;
|
|
3976
|
-
if (finalFetch || opts.fetchAbortSignal) {
|
|
3977
|
-
const callFetch = finalFetch ?? asTelegramCompatFetch(asTelegramClientFetch(globalThis.fetch));
|
|
3978
|
-
finalFetch = (input, init) => {
|
|
3979
|
-
const controller = new AbortController();
|
|
3980
|
-
const abortWith = (signal) => controller.abort(signal.reason);
|
|
3981
|
-
const shutdownSignal = opts.fetchAbortSignal;
|
|
3982
|
-
const onShutdown = () => {
|
|
3983
|
-
if (shutdownSignal) abortWith(shutdownSignal);
|
|
3984
|
-
};
|
|
3985
|
-
const method = extractTelegramApiMethod(input);
|
|
3986
|
-
const requestTimeoutMs = method === "getupdates" ? TELEGRAM_GET_UPDATES_REQUEST_TIMEOUT_MS : void 0;
|
|
3987
|
-
let requestTimeout;
|
|
3988
|
-
let onRequestAbort;
|
|
3989
|
-
const requestSignal = init?.signal;
|
|
3990
|
-
if (shutdownSignal?.aborted) abortWith(shutdownSignal);
|
|
3991
|
-
else if (shutdownSignal) shutdownSignal.addEventListener("abort", onShutdown, { once: true });
|
|
3992
|
-
if (requestSignal) if (requestSignal.aborted) abortWith(requestSignal);
|
|
3993
|
-
else {
|
|
3994
|
-
onRequestAbort = () => abortWith(requestSignal);
|
|
3995
|
-
requestSignal.addEventListener("abort", onRequestAbort);
|
|
3996
|
-
}
|
|
3997
|
-
if (requestTimeoutMs) {
|
|
3998
|
-
requestTimeout = setTimeout(() => {
|
|
3999
|
-
controller.abort(/* @__PURE__ */ new Error(`Telegram ${method} timed out after ${requestTimeoutMs}ms`));
|
|
4000
|
-
}, requestTimeoutMs);
|
|
4001
|
-
requestTimeout.unref?.();
|
|
4002
|
-
}
|
|
4003
|
-
return callFetch(input, {
|
|
4004
|
-
...init,
|
|
4005
|
-
signal: controller.signal
|
|
4006
|
-
}).finally(() => {
|
|
4007
|
-
if (requestTimeout) clearTimeout(requestTimeout);
|
|
4008
|
-
shutdownSignal?.removeEventListener("abort", onShutdown);
|
|
4009
|
-
if (requestSignal && onRequestAbort) requestSignal.removeEventListener("abort", onRequestAbort);
|
|
4010
|
-
});
|
|
4011
|
-
};
|
|
4012
|
-
}
|
|
4013
|
-
if (finalFetch) {
|
|
4014
|
-
const baseFetch = finalFetch;
|
|
4015
|
-
finalFetch = (input, init) => {
|
|
4016
|
-
return Promise.resolve(baseFetch(input, init)).catch((err) => {
|
|
4017
|
-
try {
|
|
4018
|
-
tagTelegramNetworkError(err, {
|
|
4019
|
-
method: extractTelegramApiMethod(input),
|
|
4020
|
-
url: readRequestUrl(input)
|
|
4021
|
-
});
|
|
4022
|
-
} catch {}
|
|
4023
|
-
throw err;
|
|
4024
|
-
});
|
|
4025
|
-
};
|
|
4026
|
-
}
|
|
4027
|
-
const timeoutSeconds = typeof telegramCfg?.timeoutSeconds === "number" && Number.isFinite(telegramCfg.timeoutSeconds) ? Math.max(1, Math.floor(telegramCfg.timeoutSeconds)) : void 0;
|
|
4028
|
-
const apiRoot = telegramCfg.apiRoot?.trim() || void 0;
|
|
4029
|
-
const client = finalFetch || timeoutSeconds || apiRoot ? {
|
|
4030
|
-
...finalFetch ? { fetch: asTelegramClientFetch(finalFetch) } : {},
|
|
4031
|
-
...timeoutSeconds ? { timeoutSeconds } : {},
|
|
4032
|
-
...apiRoot ? { apiRoot } : {}
|
|
4033
|
-
} : void 0;
|
|
4034
|
-
const bot = new botRuntime.Bot(opts.token, client ? { client } : void 0);
|
|
4035
|
-
bot.api.config.use(botRuntime.apiThrottler());
|
|
4036
|
-
bot.catch((err) => {
|
|
4037
|
-
runtime.error?.(danger(`telegram bot error: ${formatUncaughtError(err)}`));
|
|
4038
|
-
});
|
|
4039
|
-
const recentUpdates = createTelegramUpdateDedupe();
|
|
4040
|
-
const initialUpdateId = typeof opts.updateOffset?.lastUpdateId === "number" ? opts.updateOffset.lastUpdateId : null;
|
|
4041
|
-
const pendingUpdateIds = /* @__PURE__ */ new Set();
|
|
4042
|
-
let highestCompletedUpdateId = initialUpdateId;
|
|
4043
|
-
let highestPersistedUpdateId = initialUpdateId;
|
|
4044
|
-
const maybePersistSafeWatermark = () => {
|
|
4045
|
-
if (typeof opts.updateOffset?.onUpdateId !== "function") return;
|
|
4046
|
-
if (highestCompletedUpdateId === null) return;
|
|
4047
|
-
let safe = highestCompletedUpdateId;
|
|
4048
|
-
if (pendingUpdateIds.size > 0) {
|
|
4049
|
-
let minPending = null;
|
|
4050
|
-
for (const id of pendingUpdateIds) if (minPending === null || id < minPending) minPending = id;
|
|
4051
|
-
if (minPending !== null) safe = Math.min(safe, minPending - 1);
|
|
4052
|
-
}
|
|
4053
|
-
if (highestPersistedUpdateId !== null && safe <= highestPersistedUpdateId) return;
|
|
4054
|
-
highestPersistedUpdateId = safe;
|
|
4055
|
-
opts.updateOffset.onUpdateId(safe);
|
|
4056
|
-
};
|
|
4057
|
-
const shouldSkipUpdate = (ctx) => {
|
|
4058
|
-
const updateId = resolveTelegramUpdateId(ctx);
|
|
4059
|
-
const skipCutoff = highestPersistedUpdateId ?? initialUpdateId;
|
|
4060
|
-
if (typeof updateId === "number" && skipCutoff !== null && updateId <= skipCutoff) return true;
|
|
4061
|
-
const key = buildTelegramUpdateKey(ctx);
|
|
4062
|
-
const skipped = recentUpdates.check(key);
|
|
4063
|
-
if (skipped && key && shouldLogVerbose()) logVerbose(`telegram dedupe: skipped ${key}`);
|
|
4064
|
-
return skipped;
|
|
4065
|
-
};
|
|
4066
|
-
bot.use(async (ctx, next) => {
|
|
4067
|
-
const updateId = resolveTelegramUpdateId(ctx);
|
|
4068
|
-
if (typeof updateId === "number") pendingUpdateIds.add(updateId);
|
|
4069
|
-
try {
|
|
4070
|
-
await next();
|
|
4071
|
-
} finally {
|
|
4072
|
-
if (typeof updateId === "number") {
|
|
4073
|
-
pendingUpdateIds.delete(updateId);
|
|
4074
|
-
if (highestCompletedUpdateId === null || updateId > highestCompletedUpdateId) highestCompletedUpdateId = updateId;
|
|
4075
|
-
maybePersistSafeWatermark();
|
|
4076
|
-
}
|
|
4077
|
-
}
|
|
4078
|
-
});
|
|
4079
|
-
bot.use(botRuntime.sequentialize(getTelegramSequentialKey));
|
|
4080
|
-
const rawUpdateLogger = createSubsystemLogger("gateway/channels/telegram/raw-update");
|
|
4081
|
-
const MAX_RAW_UPDATE_CHARS = 8e3;
|
|
4082
|
-
const MAX_RAW_UPDATE_STRING = 500;
|
|
4083
|
-
const MAX_RAW_UPDATE_ARRAY = 20;
|
|
4084
|
-
const stringifyUpdate = (update) => {
|
|
4085
|
-
const seen = /* @__PURE__ */ new WeakSet();
|
|
4086
|
-
return JSON.stringify(update ?? null, (key, value) => {
|
|
4087
|
-
if (typeof value === "string" && value.length > MAX_RAW_UPDATE_STRING) return `${value.slice(0, MAX_RAW_UPDATE_STRING)}...`;
|
|
4088
|
-
if (Array.isArray(value) && value.length > MAX_RAW_UPDATE_ARRAY) return [...value.slice(0, MAX_RAW_UPDATE_ARRAY), `...(${value.length - MAX_RAW_UPDATE_ARRAY} more)`];
|
|
4089
|
-
if (value && typeof value === "object") {
|
|
4090
|
-
if (seen.has(value)) return "[Circular]";
|
|
4091
|
-
seen.add(value);
|
|
4092
|
-
}
|
|
4093
|
-
return value;
|
|
4094
|
-
});
|
|
4095
|
-
};
|
|
4096
|
-
bot.use(async (ctx, next) => {
|
|
4097
|
-
if (shouldLogVerbose()) try {
|
|
4098
|
-
const raw = stringifyUpdate(ctx.update);
|
|
4099
|
-
const preview = raw.length > MAX_RAW_UPDATE_CHARS ? `${raw.slice(0, MAX_RAW_UPDATE_CHARS)}...` : raw;
|
|
4100
|
-
rawUpdateLogger.debug(`telegram update: ${preview}`);
|
|
4101
|
-
} catch (err) {
|
|
4102
|
-
rawUpdateLogger.debug(`telegram update log failed: ${String(err)}`);
|
|
4103
|
-
}
|
|
4104
|
-
await next();
|
|
4105
|
-
});
|
|
4106
|
-
const historyLimit = Math.max(0, telegramCfg.historyLimit ?? cfg.messages?.groupChat?.historyLimit ?? 50);
|
|
4107
|
-
const groupHistories = /* @__PURE__ */ new Map();
|
|
4108
|
-
const textLimit = resolveTextChunkLimit(cfg, "telegram", account.accountId);
|
|
4109
|
-
const dmPolicy = telegramCfg.dmPolicy ?? "pairing";
|
|
4110
|
-
const allowFrom = opts.allowFrom ?? telegramCfg.allowFrom;
|
|
4111
|
-
const groupAllowFrom = opts.groupAllowFrom ?? telegramCfg.groupAllowFrom ?? telegramCfg.allowFrom ?? allowFrom;
|
|
4112
|
-
const replyToMode = opts.replyToMode ?? telegramCfg.replyToMode ?? "off";
|
|
4113
|
-
const nativeEnabled = resolveNativeCommandsEnabled({
|
|
4114
|
-
providerId: "telegram",
|
|
4115
|
-
providerSetting: telegramCfg.commands?.native,
|
|
4116
|
-
globalSetting: cfg.commands?.native
|
|
4117
|
-
});
|
|
4118
|
-
const nativeSkillsEnabled = resolveNativeSkillsEnabled({
|
|
4119
|
-
providerId: "telegram",
|
|
4120
|
-
providerSetting: telegramCfg.commands?.nativeSkills,
|
|
4121
|
-
globalSetting: cfg.commands?.nativeSkills
|
|
4122
|
-
});
|
|
4123
|
-
const nativeDisabledExplicit = isNativeCommandsExplicitlyDisabled({
|
|
4124
|
-
providerSetting: telegramCfg.commands?.native,
|
|
4125
|
-
globalSetting: cfg.commands?.native
|
|
4126
|
-
});
|
|
4127
|
-
const useAccessGroups = cfg.commands?.useAccessGroups !== false;
|
|
4128
|
-
const ackReactionScope = cfg.messages?.ackReactionScope ?? "group-mentions";
|
|
4129
|
-
const mediaMaxBytes = (opts.mediaMaxMb ?? telegramCfg.mediaMaxMb ?? 100) * 1024 * 1024;
|
|
4130
|
-
const logger = getChildLogger({ module: "telegram-auto-reply" });
|
|
4131
|
-
const streamMode = resolveTelegramStreamMode(telegramCfg);
|
|
4132
|
-
const resolveGroupPolicy = (chatId) => resolveChannelGroupPolicy({
|
|
4133
|
-
cfg,
|
|
4134
|
-
channel: "telegram",
|
|
4135
|
-
accountId: account.accountId,
|
|
4136
|
-
groupId: String(chatId)
|
|
4137
|
-
});
|
|
4138
|
-
const resolveGroupActivation = (params) => {
|
|
4139
|
-
const agentId = params.agentId ?? resolveDefaultAgentId(cfg);
|
|
4140
|
-
const sessionKey = params.sessionKey ?? `agent:${agentId}:telegram:group:${buildTelegramGroupPeerId(params.chatId, params.messageThreadId)}`;
|
|
4141
|
-
const storePath = resolveStorePath(cfg.session?.store, { agentId });
|
|
4142
|
-
try {
|
|
4143
|
-
const entry = (telegramDeps.loadSessionStore ?? loadSessionStore)(storePath)[sessionKey];
|
|
4144
|
-
if (entry?.groupActivation === "always") return false;
|
|
4145
|
-
if (entry?.groupActivation === "mention") return true;
|
|
4146
|
-
} catch (err) {
|
|
4147
|
-
logVerbose(`Failed to load session for activation check: ${String(err)}`);
|
|
4148
|
-
}
|
|
4149
|
-
};
|
|
4150
|
-
const resolveGroupRequireMention = (chatId) => resolveChannelGroupRequireMention({
|
|
4151
|
-
cfg,
|
|
4152
|
-
channel: "telegram",
|
|
4153
|
-
accountId: account.accountId,
|
|
4154
|
-
groupId: String(chatId),
|
|
4155
|
-
requireMentionOverride: opts.requireMention,
|
|
4156
|
-
overrideOrder: "after-config"
|
|
4157
|
-
});
|
|
4158
|
-
const loadFreshTelegramAccountConfig = () => {
|
|
4159
|
-
try {
|
|
4160
|
-
return resolveTelegramAccount({
|
|
4161
|
-
cfg: telegramDeps.loadConfig(),
|
|
4162
|
-
accountId: account.accountId
|
|
4163
|
-
}).config;
|
|
4164
|
-
} catch (error) {
|
|
4165
|
-
logVerbose(`telegram: failed to load fresh config for account ${account.accountId}; using startup snapshot: ${String(error)}`);
|
|
4166
|
-
return telegramCfg;
|
|
4167
|
-
}
|
|
4168
|
-
};
|
|
4169
|
-
const resolveTelegramGroupConfig = (chatId, messageThreadId) => {
|
|
4170
|
-
const freshTelegramCfg = loadFreshTelegramAccountConfig();
|
|
4171
|
-
const groups = freshTelegramCfg.groups;
|
|
4172
|
-
const direct = freshTelegramCfg.direct;
|
|
4173
|
-
const chatIdStr = String(chatId);
|
|
4174
|
-
if (!chatIdStr.startsWith("-")) {
|
|
4175
|
-
const directConfig = direct?.[chatIdStr] ?? direct?.["*"];
|
|
4176
|
-
if (directConfig) return {
|
|
4177
|
-
groupConfig: directConfig,
|
|
4178
|
-
topicConfig: messageThreadId != null ? directConfig.topics?.[String(messageThreadId)] : void 0
|
|
4179
|
-
};
|
|
4180
|
-
return {
|
|
4181
|
-
groupConfig: void 0,
|
|
4182
|
-
topicConfig: void 0
|
|
4183
|
-
};
|
|
4184
|
-
}
|
|
4185
|
-
if (!groups) return {
|
|
4186
|
-
groupConfig: void 0,
|
|
4187
|
-
topicConfig: void 0
|
|
4188
|
-
};
|
|
4189
|
-
const groupConfig = groups[chatIdStr] ?? groups["*"];
|
|
4190
|
-
return {
|
|
4191
|
-
groupConfig,
|
|
4192
|
-
topicConfig: messageThreadId != null ? groupConfig?.topics?.[String(messageThreadId)] : void 0
|
|
4193
|
-
};
|
|
4194
|
-
};
|
|
4195
|
-
const processMessage = createTelegramMessageProcessor({
|
|
4196
|
-
bot,
|
|
4197
|
-
cfg,
|
|
4198
|
-
account,
|
|
4199
|
-
telegramCfg,
|
|
4200
|
-
historyLimit,
|
|
4201
|
-
groupHistories,
|
|
4202
|
-
dmPolicy,
|
|
4203
|
-
allowFrom,
|
|
4204
|
-
groupAllowFrom,
|
|
4205
|
-
ackReactionScope,
|
|
4206
|
-
logger,
|
|
4207
|
-
resolveGroupActivation,
|
|
4208
|
-
resolveGroupRequireMention,
|
|
4209
|
-
resolveTelegramGroupConfig,
|
|
4210
|
-
loadFreshConfig: () => telegramDeps.loadConfig(),
|
|
4211
|
-
sendChatActionHandler: createTelegramSendChatActionHandler({
|
|
4212
|
-
sendChatActionFn: (chatId, action, threadParams) => bot.api.sendChatAction(chatId, action, threadParams),
|
|
4213
|
-
logger: (message) => logVerbose(`telegram: ${message}`)
|
|
4214
|
-
}),
|
|
4215
|
-
runtime,
|
|
4216
|
-
replyToMode,
|
|
4217
|
-
streamMode,
|
|
4218
|
-
textLimit,
|
|
4219
|
-
opts,
|
|
4220
|
-
telegramDeps
|
|
4221
|
-
});
|
|
4222
|
-
registerTelegramNativeCommands({
|
|
4223
|
-
bot,
|
|
4224
|
-
cfg,
|
|
4225
|
-
runtime,
|
|
4226
|
-
accountId: account.accountId,
|
|
4227
|
-
telegramCfg,
|
|
4228
|
-
allowFrom,
|
|
4229
|
-
groupAllowFrom,
|
|
4230
|
-
replyToMode,
|
|
4231
|
-
textLimit,
|
|
4232
|
-
useAccessGroups,
|
|
4233
|
-
nativeEnabled,
|
|
4234
|
-
nativeSkillsEnabled,
|
|
4235
|
-
nativeDisabledExplicit,
|
|
4236
|
-
resolveGroupPolicy,
|
|
4237
|
-
resolveTelegramGroupConfig,
|
|
4238
|
-
shouldSkipUpdate,
|
|
4239
|
-
opts,
|
|
4240
|
-
telegramDeps
|
|
4241
|
-
});
|
|
4242
|
-
registerTelegramHandlers({
|
|
4243
|
-
cfg,
|
|
4244
|
-
accountId: account.accountId,
|
|
4245
|
-
bot,
|
|
4246
|
-
opts,
|
|
4247
|
-
telegramTransport,
|
|
4248
|
-
runtime,
|
|
4249
|
-
mediaMaxBytes,
|
|
4250
|
-
telegramCfg,
|
|
4251
|
-
allowFrom,
|
|
4252
|
-
groupAllowFrom,
|
|
4253
|
-
resolveGroupPolicy,
|
|
4254
|
-
resolveTelegramGroupConfig,
|
|
4255
|
-
shouldSkipUpdate,
|
|
4256
|
-
processMessage,
|
|
4257
|
-
logger,
|
|
4258
|
-
telegramDeps
|
|
4259
|
-
});
|
|
4260
|
-
const originalStop = bot.stop.bind(bot);
|
|
4261
|
-
bot.stop = ((...args) => {
|
|
4262
|
-
threadBindingManager?.stop();
|
|
4263
|
-
return originalStop(...args);
|
|
4264
|
-
});
|
|
4265
|
-
return bot;
|
|
4266
|
-
}
|
|
4267
|
-
//#endregion
|
|
4268
|
-
export { TelegramExecApprovalHandler as n, createTelegramBot as t };
|