@hanzo/bot 2026.3.9 → 2026.3.10
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/dist/{accounts-C2vo5fEt.js → accounts-B4Cft76I.js} +2 -2
- package/dist/{accounts-DNligSyz.js → accounts-C_LXSS3x.js} +2 -2
- package/dist/{accounts-B-9Bhdn6.js → accounts-Cp7zE1zb.js} +17 -17
- package/dist/{active-listener-zLV9i9LQ.js → active-listener-BR7vpJxr.js} +2 -2
- package/dist/{api-key-rotation-BENZC8ep.js → api-key-rotation-iYITGuLK.js} +2 -2
- package/dist/{audio-preflight-D_s-peid.js → audio-preflight-BnfuyvxO.js} +4 -4
- package/dist/{audio-preflight-Bd44yEnM.js → audio-preflight-CpAXC_Ct.js} +32 -32
- package/dist/{audio-transcription-runner-CsXaWVup.js → audio-transcription-runner-CAOjjGxN.js} +12 -12
- package/dist/{audio-transcription-runner-BePCnZfw.js → audio-transcription-runner-GcMnO6sT.js} +1 -1
- package/dist/{audit-membership-runtime-BJ149bTU.js → audit-membership-runtime-CVVxrZ7j.js} +4 -4
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +51 -51
- package/dist/bundled/bootstrap-extra-files/handler.js +6 -6
- package/dist/bundled/command-logger/handler.js +2 -2
- package/dist/bundled/session-memory/handler.js +51 -51
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{channel-activity-DO-d_jr4.js → channel-activity-DR4SiHcg.js} +3 -3
- package/dist/{chrome-B24-8NDM.js → chrome--CFg5C_H.js} +8 -8
- package/dist/{chrome-hkgY24uS.js → chrome-jCt9JCU8.js} +18 -18
- package/dist/{cloud-connect-CknfBF39.js → cloud-connect-6kdj8st_.js} +1 -1
- package/dist/{commands-registry-C6INZSSX.js → commands-registry-Ce7SJnAP.js} +4 -4
- package/dist/{deliver-B1PE5Kmq.js → deliver-BVtVDxwX.js} +21 -21
- package/dist/{deliver-DudaV86i.js → deliver-DmfS4khs.js} +1 -1
- package/dist/deliver-runtime-G0G5orrZ.js +36 -0
- package/dist/{deliver-runtime-qDmQqiF-.js → deliver-runtime-PxJvVUhh.js} +3 -3
- package/dist/deps-send-discord.runtime-BM3uHet5.js +26 -0
- package/dist/deps-send-imessage.runtime-CBlUhUeN.js +25 -0
- package/dist/deps-send-signal.runtime-DnH0lazO.js +24 -0
- package/dist/deps-send-slack.runtime-Dmq0lsvR.js +22 -0
- package/dist/deps-send-telegram.runtime-33sbp3Ol.js +27 -0
- package/dist/deps-send-whatsapp.runtime-8bLqjmui.js +60 -0
- package/dist/{deps-send-whatsapp.runtime-Cq-TLsJw.js → deps-send-whatsapp.runtime-CrzuaVhC.js} +7 -7
- package/dist/{diagnostic-Do7hUiao.js → diagnostic-D1IbJfJM.js} +2 -2
- package/dist/entry.js +1 -1
- package/dist/{errors-DDrhcWHi.js → errors-CHd6Q-vF.js} +1 -1
- package/dist/extensionAPI.js +6 -6
- package/dist/{fetch-BETRLmK8.js → fetch-C6doVJxZ.js} +5 -5
- package/dist/{fetch-guard-pwJ-F5aP.js → fetch-guard-C-neMX4E.js} +2 -2
- package/dist/{frontmatter-BFHzrAY7.js → frontmatter-B6XNqDx2.js} +3 -3
- package/dist/{fs-safe-CeZ_BXcn.js → fs-safe-DmeSz0Nd.js} +4 -4
- package/dist/{github-copilot-token-D13V9YBz.js → github-copilot-token-BDioPmd6.js} +7 -7
- package/dist/{image-nUHQF6BX.js → image-BdZcUz8M.js} +1 -1
- package/dist/{image-DJo3nF6e.js → image-DSK1hSSV.js} +6 -6
- package/dist/{image-ops-CLQ9abCf.js → image-ops-C-QWxnVw.js} +2 -2
- package/dist/{image-runtime-B5M_-diF.js → image-runtime-ueqmfx1a.js} +3 -3
- package/dist/image-runtime-xqxW2PQA.js +29 -0
- package/dist/{ir-9Bn85Mqy.js → ir-B0iARYlT.js} +8 -8
- package/dist/{legacy-names-Bkl4tjN-.js → legacy-names-DZdACm3t.js} +1 -1
- package/dist/llm-slug-generator.js +51 -51
- package/dist/{local-launch-C2RER-G3.js → local-launch-BJpBAIR5.js} +37 -33
- package/dist/{logger-D4RcXHR-.js → logger-LCC1m_20.js} +7 -7
- package/dist/{login-nNeuyFrd.js → login-BbBqhgOM.js} +5 -5
- package/dist/{login-qr-BEawmd_E.js → login-qr-AAX0vgZR.js} +10 -10
- package/dist/{manager-Bq6y1TH8.js → manager-BOyc7q1-.js} +13 -13
- package/dist/manager-runtime-20Upetpf.js +18 -0
- package/dist/{model-selection-DQ5NblsF.js → model-selection-BNMWRHZu.js} +43 -43
- package/dist/{outbound-CPL9ID8o.js → outbound-C72ULCcI.js} +6 -6
- package/dist/{outbound-attachment-BmiVeNLr.js → outbound-attachment-BF1JVcCB.js} +2 -2
- package/dist/{path-alias-guards-DBVdJRcc.js → path-alias-guards-BCv18tKc.js} +1 -1
- package/dist/{paths-C6TxBCvO.js → paths-Cvc9EM8Y.js} +5 -5
- package/dist/{paths-Cgd1FfOW.js → paths-l8GkNRRD.js} +4 -4
- package/dist/{pi-embedded-BYfpUcIY.js → pi-embedded-DBn841N-.js} +159 -159
- package/dist/{pi-embedded-DvWHP6Nn.js → pi-embedded-DYc6emwb.js} +24 -24
- package/dist/{pi-embedded-helpers-_OL4yNw0.js → pi-embedded-helpers-BtnBVL-4.js} +52 -52
- package/dist/{pi-embedded-helpers-Ck1qEeMH.js → pi-embedded-helpers-DLm1Mtr2.js} +3 -3
- package/dist/{pi-model-discovery-DANpv7pw.js → pi-model-discovery-Cucu_uXw.js} +7 -7
- package/dist/pi-model-discovery-runtime-BcJAGnf4.js +11 -0
- package/dist/{pi-tools.before-tool-call.runtime-CLb1M0uM.js → pi-tools.before-tool-call.runtime-DQ2d5nM_.js} +9 -9
- package/dist/plugin-sdk/accounts-B8qv93DH.js +35 -0
- package/dist/plugin-sdk/accounts-D2p8t4UO.js +288 -0
- package/dist/plugin-sdk/accounts-D96D1U9M.js +46 -0
- package/dist/plugin-sdk/active-listener-Mha1rAbh.js +50 -0
- package/dist/plugin-sdk/api-key-rotation-D0aZfxXH.js +181 -0
- package/dist/plugin-sdk/audio-preflight-D3y8mHJa.js +69 -0
- package/dist/plugin-sdk/audio-transcription-runner-j0mQXKSH.js +2205 -0
- package/dist/plugin-sdk/audit-membership-runtime-D-Ni2WDc.js +58 -0
- package/dist/plugin-sdk/channel-activity-VpA3MxPb.js +94 -0
- package/dist/plugin-sdk/channel-web-BP3vDdim.js +2256 -0
- package/dist/plugin-sdk/chrome-5jJIDTj0.js +2447 -0
- package/dist/plugin-sdk/commands-registry-BVKCdwN_.js +1125 -0
- package/dist/plugin-sdk/config-CudVTZDi.js +18200 -0
- package/dist/plugin-sdk/deliver-4NrmrRKu.js +1744 -0
- package/dist/plugin-sdk/deliver-runtime-CB4wXMTH.js +32 -0
- package/dist/plugin-sdk/deps-send-discord.runtime-Di8ELKED.js +23 -0
- package/dist/plugin-sdk/deps-send-imessage.runtime-CWWtApbz.js +22 -0
- package/dist/plugin-sdk/deps-send-signal.runtime-C6BGyoIY.js +21 -0
- package/dist/plugin-sdk/deps-send-slack.runtime-DgtITBuc.js +19 -0
- package/dist/plugin-sdk/deps-send-telegram.runtime-DyY4XRxh.js +24 -0
- package/dist/plugin-sdk/deps-send-whatsapp.runtime-LKiQNFcF.js +57 -0
- package/dist/plugin-sdk/diagnostic-DCPixRez.js +319 -0
- package/dist/plugin-sdk/discord.js +6 -6
- package/dist/plugin-sdk/errors-D5bA02--.js +54 -0
- package/dist/plugin-sdk/fetch-guard-n0LVdzZL.js +156 -0
- package/dist/plugin-sdk/fs-safe-IQ0H7rVD.js +352 -0
- package/dist/plugin-sdk/image-n-R2HcNg.js +2314 -0
- package/dist/plugin-sdk/image-ops-BpYDXC6N.js +584 -0
- package/dist/plugin-sdk/image-runtime-CbCl82B8.js +25 -0
- package/dist/plugin-sdk/index.js +50 -50
- package/dist/plugin-sdk/ir-DsMX3GcS.js +1296 -0
- package/dist/plugin-sdk/local-roots-DR-lR22p.js +186 -0
- package/dist/plugin-sdk/logger-2A0UE34q.js +1163 -0
- package/dist/plugin-sdk/login-CxFTtHEi.js +57 -0
- package/dist/plugin-sdk/login-qr-BCkrf1Zx.js +320 -0
- package/dist/plugin-sdk/manager-ClUgSFkG.js +3943 -0
- package/dist/plugin-sdk/manager-runtime-MWzYCRyH.js +15 -0
- package/dist/plugin-sdk/outbound-Dqs8L8QW.js +212 -0
- package/dist/plugin-sdk/outbound-attachment-CPfpUcdI.js +19 -0
- package/dist/plugin-sdk/path-alias-guards-LILr7Hrs.js +43 -0
- package/dist/plugin-sdk/paths-CfGmXu9A.js +166 -0
- package/dist/plugin-sdk/pi-embedded-helpers-CeC8GbRi.js +9731 -0
- package/dist/plugin-sdk/pi-model-discovery-DycOMKYh.js +134 -0
- package/dist/plugin-sdk/pi-model-discovery-runtime-C64BYe5F.js +8 -0
- package/dist/plugin-sdk/pi-tools.before-tool-call.runtime-C-HNtPSw.js +354 -0
- package/dist/plugin-sdk/plugins-2gQWMmUN.js +1205 -0
- package/dist/{proxy-fetch-ChfJDZwG.js → plugin-sdk/proxy-fetch-sX3-xzX1.js} +1 -1
- package/dist/plugin-sdk/pw-ai-D7FTxM3C.js +1938 -0
- package/dist/plugin-sdk/qmd-manager-Da3Jq30m.js +1608 -0
- package/dist/plugin-sdk/query-expansion-B5Z0In1U.js +1014 -0
- package/dist/{redact-DGz6yigq.js → plugin-sdk/redact-85H1J7mo.js} +1 -1
- package/dist/plugin-sdk/reply-DmCyOPxV.js +102224 -0
- package/dist/plugin-sdk/resolve-outbound-target-y0Sp7gsM.js +40 -0
- package/dist/plugin-sdk/run-with-concurrency-CFRxflYW.js +1994 -0
- package/dist/plugin-sdk/runtime-whatsapp-login.runtime-fgm84Rdh.js +10 -0
- package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-DpMuLd_h.js +19 -0
- package/dist/plugin-sdk/send-BQvcPd54.js +3135 -0
- package/dist/plugin-sdk/send-Bplfz7UW.js +540 -0
- package/dist/plugin-sdk/send-C8gdhoLP.js +414 -0
- package/dist/plugin-sdk/send-CTOVZqmi.js +2602 -0
- package/dist/plugin-sdk/send-Cld7xlxq.js +503 -0
- package/dist/plugin-sdk/session-D4k86ARy.js +169 -0
- package/dist/plugin-sdk/signal.js +2 -2
- package/dist/plugin-sdk/skill-commands-BfHvtJx2.js +353 -0
- package/dist/plugin-sdk/skills-BrE5Yb5o.js +1428 -0
- package/dist/plugin-sdk/slash-commands.runtime-UpSrdY-a.js +13 -0
- package/dist/plugin-sdk/slash-dispatch.runtime-C-Ymizf2.js +52 -0
- package/dist/plugin-sdk/slash-skill-commands.runtime-Bb9wo3w0.js +16 -0
- package/dist/plugin-sdk/ssrf-CbvrROKN.js +202 -0
- package/dist/plugin-sdk/store-8XS_isi_.js +81 -0
- package/dist/plugin-sdk/subagent-registry-runtime-Cl3jJKM1.js +52 -0
- package/dist/plugin-sdk/tables-BhfDBQ58.js +55 -0
- package/dist/{target-errors-CxUP9L6c.js → plugin-sdk/target-errors-0DW3k-Ae.js} +2 -2
- package/dist/plugin-sdk/thinking-DE2FCBnv.js +1209 -0
- package/dist/{tokens-Cyi-NbsV.js → plugin-sdk/tokens-C2tJ8uXs.js} +1 -1
- package/dist/plugin-sdk/tool-images-B1I6LEp7.js +274 -0
- package/dist/plugin-sdk/web-BHzDLmns.js +56 -0
- package/dist/plugin-sdk/whatsapp-actions-BoAH0BAS.js +80 -0
- package/dist/{plugins-CeflwBVL.js → plugins-YJZX7mvv.js} +13 -13
- package/dist/{proxy-env-zUD967XQ.js → proxy-env-CreSu2Ej.js} +1 -1
- package/dist/proxy-fetch-lxJGuoUa.js +38 -0
- package/dist/{pw-ai-DweqbnMJ.js → pw-ai-C-Sy12jT.js} +1 -1
- package/dist/{pw-ai-yR5naMge.js → pw-ai-pJMhS79V.js} +14 -14
- package/dist/{qmd-manager-CWAXF3Vk.js → qmd-manager-5C5L5YNn.js} +10 -10
- package/dist/{query-expansion-Cbd21KuP.js → query-expansion-BeRz7_bo.js} +6 -6
- package/dist/redact-DqlKR0-n.js +319 -0
- package/dist/{run-main-CgFUs81l.js → run-main-JI9-1g4u.js} +2 -2
- package/dist/{run-with-concurrency-kEFC1Fle.js → run-with-concurrency-ffnO0KnQ.js} +4 -4
- package/dist/runtime-whatsapp-login.runtime-BcbYtLph.js +13 -0
- package/dist/runtime-whatsapp-outbound.runtime-MIKcURpN.js +22 -0
- package/dist/{send-DKjV2v4c.js → send-BXQ1U9Zk.js} +5 -5
- package/dist/{send-C4kartXc.js → send-BrlM68Dd.js} +6 -6
- package/dist/{send-DqQOo6dv.js → send-CKIMBFLs.js} +8 -8
- package/dist/{send-Bi_r7Hno.js → send-CmVj590_.js} +7 -7
- package/dist/{send-CisFoCif.js → send-Cp6dmr2f.js} +28 -28
- package/dist/{session-U4Hk8Woy.js → session-DoD05Mm8.js} +8 -8
- package/dist/{skill-commands-BN9qtrxT.js → skill-commands-DGy6Juvb.js} +9 -9
- package/dist/{skills-DgwotBrr.js → skills-BDJUqEFI.js} +22 -22
- package/dist/slash-commands.runtime-2kptrdDi.js +16 -0
- package/dist/slash-dispatch.runtime-DLP2IeNv.js +56 -0
- package/dist/{slash-dispatch.runtime-DzpJjr3K.js → slash-dispatch.runtime-Vp6IDoCc.js} +6 -6
- package/dist/slash-skill-commands.runtime-6jUbSMOW.js +20 -0
- package/dist/{store-CNWtYorN.js → store-cJlS-gR6.js} +2 -2
- package/dist/{subagent-registry-runtime-a7xfwPB8.js → subagent-registry-runtime-BlAI3eqU.js} +6 -6
- package/dist/subagent-registry-runtime-COKZwsHd.js +56 -0
- package/dist/{subsystem-W834z9Wa.js → subsystem-CdFYjh2k.js} +14 -14
- package/dist/{tables-DBZFzS9x.js → tables-CgcFNr6G.js} +1 -1
- package/dist/target-errors-DPj6Es2y.js +195 -0
- package/dist/{thinking-Xlbm5WNq.js → thinking-C3b10cHs.js} +7 -7
- package/dist/tokens-mtgzW7UN.js +52 -0
- package/dist/{tool-images-D217wDXi.js → tool-images-D9pdW1gE.js} +2 -2
- package/dist/{web-o9PMPEDK.js → web-BEuMJbx-.js} +55 -55
- package/dist/{web-IBqHOVI2.js → web-BvId86u4.js} +6 -6
- package/dist/{whatsapp-actions-DmKZmCkz.js → whatsapp-actions-nZnQ4BwK.js} +21 -21
- package/dist/{workspace-CPNwHoy5.js → workspace-BC5WA0Th.js} +20 -20
- package/extensions/acpx/package.json +1 -1
- package/extensions/bluebubbles/package.json +1 -1
- package/extensions/ci-fix-loop/package.json +1 -1
- package/extensions/continuous-learning/package.json +1 -1
- package/extensions/copilot-proxy/package.json +1 -1
- package/extensions/diagnostics-otel/package.json +1 -1
- package/extensions/diffs/package.json +1 -1
- package/extensions/discord/package.json +1 -1
- package/extensions/feishu/package.json +1 -1
- package/extensions/flow/package.json +1 -1
- package/extensions/google-antigravity-auth/package.json +1 -1
- package/extensions/google-gemini-cli-auth/package.json +1 -1
- package/extensions/googlechat/package.json +1 -1
- package/extensions/imessage/package.json +1 -1
- package/extensions/irc/package.json +1 -1
- package/extensions/line/package.json +1 -1
- package/extensions/llm-task/package.json +1 -1
- package/extensions/lobster/package.json +1 -1
- package/extensions/matrix/CHANGELOG.md +5 -0
- package/extensions/matrix/package.json +1 -1
- package/extensions/mattermost/package.json +1 -1
- package/extensions/memory-core/package.json +1 -1
- package/extensions/memory-lancedb/package.json +1 -1
- package/extensions/minimax-portal-auth/package.json +1 -1
- package/extensions/msteams/CHANGELOG.md +5 -0
- package/extensions/msteams/package.json +1 -1
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nostr/CHANGELOG.md +5 -0
- package/extensions/nostr/package.json +1 -1
- package/extensions/open-prose/package.json +1 -1
- package/extensions/self-improvement/package.json +1 -1
- package/extensions/signal/package.json +1 -1
- package/extensions/slack/package.json +1 -1
- package/extensions/synology-chat/package.json +1 -1
- package/extensions/telegram/package.json +1 -1
- package/extensions/tlon/package.json +1 -1
- package/extensions/twitch/CHANGELOG.md +5 -0
- package/extensions/twitch/package.json +1 -1
- package/extensions/voice-call/CHANGELOG.md +5 -0
- package/extensions/voice-call/package.json +1 -1
- package/extensions/whatsapp/package.json +1 -1
- package/extensions/zalo/CHANGELOG.md +5 -0
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalouser/CHANGELOG.md +5 -0
- package/extensions/zalouser/package.json +1 -1
- package/package.json +1 -1
- package/dist/deliver-runtime-L42k3QaI.js +0 -36
- package/dist/deps-send-discord.runtime-DSqcSnN3.js +0 -26
- package/dist/deps-send-imessage.runtime-Ch2ZcE2r.js +0 -25
- package/dist/deps-send-signal.runtime-c-v7bD8y.js +0 -24
- package/dist/deps-send-slack.runtime-xA-JRpSq.js +0 -22
- package/dist/deps-send-telegram.runtime-CO2npp7q.js +0 -27
- package/dist/deps-send-whatsapp.runtime-wvdxQphB.js +0 -60
- package/dist/image-runtime-Bd2-_2Fa.js +0 -29
- package/dist/manager-runtime-DNkH2nza.js +0 -18
- package/dist/pi-model-discovery-runtime-Dr5-MM2j.js +0 -11
- package/dist/runtime-whatsapp-login.runtime-BKnJdTKn.js +0 -13
- package/dist/runtime-whatsapp-outbound.runtime-DZYgfcRc.js +0 -22
- package/dist/slash-commands.runtime-iBi9rbmg.js +0 -16
- package/dist/slash-dispatch.runtime-8okSdt7k.js +0 -56
- package/dist/slash-skill-commands.runtime-a4qnxIQp.js +0 -20
- package/dist/subagent-registry-runtime-C4H5Ofm0.js +0 -56
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import "./paths-MKyEVmEb.js";
|
|
2
|
+
import { y as isRecord } from "./logger-2A0UE34q.js";
|
|
3
|
+
import { n as fetchWithTimeout } from "./fetch-timeout-D455O27U.js";
|
|
4
|
+
import { t as makeProxyFetch } from "./proxy-fetch-sX3-xzX1.js";
|
|
5
|
+
import "./proxy-BFm9FJeW.js";
|
|
6
|
+
|
|
7
|
+
//#region src/telegram/audit-membership-runtime.ts
|
|
8
|
+
const TELEGRAM_API_BASE = "https://api.telegram.org";
|
|
9
|
+
async function auditTelegramGroupMembershipImpl(params) {
|
|
10
|
+
const fetcher = params.proxyUrl ? makeProxyFetch(params.proxyUrl) : fetch;
|
|
11
|
+
const base = `${TELEGRAM_API_BASE}/bot${params.token}`;
|
|
12
|
+
const groups = [];
|
|
13
|
+
for (const chatId of params.groupIds) try {
|
|
14
|
+
const res = await fetchWithTimeout(`${base}/getChatMember?chat_id=${encodeURIComponent(chatId)}&user_id=${encodeURIComponent(String(params.botId))}`, {}, params.timeoutMs, fetcher);
|
|
15
|
+
const json = await res.json();
|
|
16
|
+
if (!res.ok || !isRecord(json) || !json.ok) {
|
|
17
|
+
const desc = isRecord(json) && !json.ok && typeof json.description === "string" ? json.description : `getChatMember failed (${res.status})`;
|
|
18
|
+
groups.push({
|
|
19
|
+
chatId,
|
|
20
|
+
ok: false,
|
|
21
|
+
status: null,
|
|
22
|
+
error: desc,
|
|
23
|
+
matchKey: chatId,
|
|
24
|
+
matchSource: "id"
|
|
25
|
+
});
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const status = isRecord(json.result) ? json.result.status ?? null : null;
|
|
29
|
+
const ok = status === "creator" || status === "administrator" || status === "member";
|
|
30
|
+
groups.push({
|
|
31
|
+
chatId,
|
|
32
|
+
ok,
|
|
33
|
+
status,
|
|
34
|
+
error: ok ? null : "bot not in group",
|
|
35
|
+
matchKey: chatId,
|
|
36
|
+
matchSource: "id"
|
|
37
|
+
});
|
|
38
|
+
} catch (err) {
|
|
39
|
+
groups.push({
|
|
40
|
+
chatId,
|
|
41
|
+
ok: false,
|
|
42
|
+
status: null,
|
|
43
|
+
error: err instanceof Error ? err.message : String(err),
|
|
44
|
+
matchKey: chatId,
|
|
45
|
+
matchSource: "id"
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
ok: groups.every((g) => g.ok),
|
|
50
|
+
checkedGroups: groups.length,
|
|
51
|
+
unresolvedGroups: 0,
|
|
52
|
+
hasWildcardUnmentionedGroups: false,
|
|
53
|
+
groups
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
export { auditTelegramGroupMembershipImpl };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Gn as resolveRetryConfig, Kn as retryAsync } from "./config-CudVTZDi.js";
|
|
2
|
+
import { a as createSubsystemLogger } from "./logger-2A0UE34q.js";
|
|
3
|
+
import { r as formatErrorMessage } from "./errors-D5bA02--.js";
|
|
4
|
+
import { RateLimitError } from "@buape/carbon";
|
|
5
|
+
|
|
6
|
+
//#region src/infra/retry-policy.ts
|
|
7
|
+
const DISCORD_RETRY_DEFAULTS = {
|
|
8
|
+
attempts: 3,
|
|
9
|
+
minDelayMs: 500,
|
|
10
|
+
maxDelayMs: 3e4,
|
|
11
|
+
jitter: .1
|
|
12
|
+
};
|
|
13
|
+
const TELEGRAM_RETRY_DEFAULTS = {
|
|
14
|
+
attempts: 3,
|
|
15
|
+
minDelayMs: 400,
|
|
16
|
+
maxDelayMs: 3e4,
|
|
17
|
+
jitter: .1
|
|
18
|
+
};
|
|
19
|
+
const TELEGRAM_RETRY_RE = /429|timeout|connect|reset|closed|unavailable|temporarily/i;
|
|
20
|
+
const log = createSubsystemLogger("retry-policy");
|
|
21
|
+
function getTelegramRetryAfterMs(err) {
|
|
22
|
+
if (!err || typeof err !== "object") return;
|
|
23
|
+
const candidate = "parameters" in err && err.parameters && typeof err.parameters === "object" ? err.parameters.retry_after : "response" in err && err.response && typeof err.response === "object" && "parameters" in err.response ? err.response.parameters?.retry_after : "error" in err && err.error && typeof err.error === "object" && "parameters" in err.error ? err.error.parameters?.retry_after : void 0;
|
|
24
|
+
return typeof candidate === "number" && Number.isFinite(candidate) ? candidate * 1e3 : void 0;
|
|
25
|
+
}
|
|
26
|
+
function createDiscordRetryRunner(params) {
|
|
27
|
+
const retryConfig = resolveRetryConfig(DISCORD_RETRY_DEFAULTS, {
|
|
28
|
+
...params.configRetry,
|
|
29
|
+
...params.retry
|
|
30
|
+
});
|
|
31
|
+
return (fn, label) => retryAsync(fn, {
|
|
32
|
+
...retryConfig,
|
|
33
|
+
label,
|
|
34
|
+
shouldRetry: (err) => err instanceof RateLimitError,
|
|
35
|
+
retryAfterMs: (err) => err instanceof RateLimitError ? err.retryAfter * 1e3 : void 0,
|
|
36
|
+
onRetry: params.verbose ? (info) => {
|
|
37
|
+
const labelText = info.label ?? "request";
|
|
38
|
+
const maxRetries = Math.max(1, info.maxAttempts - 1);
|
|
39
|
+
log.warn(`discord ${labelText} rate limited, retry ${info.attempt}/${maxRetries} in ${info.delayMs}ms`);
|
|
40
|
+
} : void 0
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function createTelegramRetryRunner(params) {
|
|
44
|
+
const retryConfig = resolveRetryConfig(TELEGRAM_RETRY_DEFAULTS, {
|
|
45
|
+
...params.configRetry,
|
|
46
|
+
...params.retry
|
|
47
|
+
});
|
|
48
|
+
const shouldRetry = params.shouldRetry ? (err) => params.shouldRetry?.(err) || TELEGRAM_RETRY_RE.test(formatErrorMessage(err)) : (err) => TELEGRAM_RETRY_RE.test(formatErrorMessage(err));
|
|
49
|
+
return (fn, label) => retryAsync(fn, {
|
|
50
|
+
...retryConfig,
|
|
51
|
+
label,
|
|
52
|
+
shouldRetry,
|
|
53
|
+
retryAfterMs: getTelegramRetryAfterMs,
|
|
54
|
+
onRetry: params.verbose ? (info) => {
|
|
55
|
+
const maxRetries = Math.max(1, info.maxAttempts - 1);
|
|
56
|
+
log.warn(`telegram send retry ${info.attempt}/${maxRetries} for ${info.label ?? label ?? "request"} in ${info.delayMs}ms: ${formatErrorMessage(info.err)}`);
|
|
57
|
+
} : void 0
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/infra/channel-activity.ts
|
|
63
|
+
const activity = /* @__PURE__ */ new Map();
|
|
64
|
+
function keyFor(channel, accountId) {
|
|
65
|
+
return `${channel}:${accountId || "default"}`;
|
|
66
|
+
}
|
|
67
|
+
function ensureEntry(channel, accountId) {
|
|
68
|
+
const key = keyFor(channel, accountId);
|
|
69
|
+
const existing = activity.get(key);
|
|
70
|
+
if (existing) return existing;
|
|
71
|
+
const created = {
|
|
72
|
+
inboundAt: null,
|
|
73
|
+
outboundAt: null
|
|
74
|
+
};
|
|
75
|
+
activity.set(key, created);
|
|
76
|
+
return created;
|
|
77
|
+
}
|
|
78
|
+
function recordChannelActivity(params) {
|
|
79
|
+
const at = typeof params.at === "number" ? params.at : Date.now();
|
|
80
|
+
const accountId = params.accountId?.trim() || "default";
|
|
81
|
+
const entry = ensureEntry(params.channel, accountId);
|
|
82
|
+
if (params.direction === "inbound") entry.inboundAt = at;
|
|
83
|
+
if (params.direction === "outbound") entry.outboundAt = at;
|
|
84
|
+
}
|
|
85
|
+
function getChannelActivity(params) {
|
|
86
|
+
const accountId = params.accountId?.trim() || "default";
|
|
87
|
+
return activity.get(keyFor(params.channel, accountId)) ?? {
|
|
88
|
+
inboundAt: null,
|
|
89
|
+
outboundAt: null
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
export { createTelegramRetryRunner as i, recordChannelActivity as n, createDiscordRetryRunner as r, getChannelActivity as t };
|