squidclaw 3.0.32 → 3.0.34
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-BFS_qklA.js → accounts-CB2Or0mr.js} +2 -2
- package/dist/{accounts-DfrJiFJJ.js → accounts-Cop2dSRo.js} +2 -2
- package/dist/{accounts-pMDX8iho.js → accounts-CqITV0Ga.js} +4 -4
- package/dist/{active-listener-CH2vJ3EZ.js → active-listener-B6G6kmsb.js} +2 -2
- package/dist/{api-key-rotation-DCBXT0v7.js → api-key-rotation-Da2qYrP7.js} +2 -2
- package/dist/{audio-preflight-B5XvcdFX.js → audio-preflight-yiMsGLW7.js} +30 -30
- package/dist/{audio-transcription-runner-DUC0ItDY.js → audio-transcription-runner-Mha07yP4.js} +12 -12
- package/dist/{audit-membership-runtime-czdecfjJ.js → audit-membership-runtime-By9-qSwl.js} +3 -3
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +49 -49
- package/dist/bundled/bootstrap-extra-files/handler.js +5 -5
- package/dist/bundled/command-logger/handler.js +1 -1
- package/dist/bundled/session-memory/HOOK.md +2 -1
- package/dist/bundled/session-memory/handler.js +190 -55
- package/dist/{channel-activity-7QMEKenc.js → channel-activity-Du1kh0t3.js} +3 -3
- package/dist/{chrome-BTwG9Gvh.js → chrome-C2CliEWR.js} +15 -15
- package/dist/{commands-registry-BIi1tG__.js → commands-registry-6jWzz0mk.js} +4 -4
- package/dist/{deliver-DZCNXFM8.js → deliver-Ddw3EsOV.js} +11 -11
- package/dist/deliver-runtime-CF9aNwHW.js +36 -0
- package/dist/deps-send-discord.runtime-BdlL7AnG.js +26 -0
- package/dist/deps-send-imessage.runtime-BQx5JSa_.js +25 -0
- package/dist/deps-send-signal.runtime-dgrmoRN9.js +24 -0
- package/dist/deps-send-slack.runtime-CCOjVEQr.js +22 -0
- package/dist/deps-send-telegram.runtime-BgwTF5zt.js +27 -0
- package/dist/deps-send-whatsapp.runtime-C_zE7G9V.js +60 -0
- package/dist/{deps-send-whatsapp.runtime-rPF4BAeN.js → deps-send-whatsapp.runtime-DhuS0SeA.js} +2 -2
- package/dist/{diagnostic-4Dbmo6KU.js → diagnostic-B74jJPqv.js} +2 -2
- package/dist/{errors-Dih7OXdL.js → errors-CCLnP2Fs.js} +1 -1
- package/dist/extensionAPI.js +1 -1
- package/dist/{fetch-COEkF6YP.js → fetch-OMudX6HR.js} +4 -4
- package/dist/{fetch-guard-CcP28UT1.js → fetch-guard-DBZ7o2IA.js} +2 -2
- package/dist/{frontmatter-LLGh43CC.js → frontmatter-vSrur-r-.js} +3 -3
- package/dist/{fs-safe-NHJJ1b9f.js → fs-safe-Dy2_iDiY.js} +3 -3
- package/dist/{image-COAbpp2B.js → image-CdfqhHaX.js} +6 -6
- package/dist/{image-ops-QLLBkxzG.js → image-ops-BQmWYj-1.js} +2 -2
- package/dist/image-runtime-BFxy3jl0.js +29 -0
- package/dist/{ir-RKRKj5a9.js → ir-DEPhOdwg.js} +8 -8
- package/dist/{legacy-names-CR_H5NWa.js → legacy-names-CDxprteD.js} +1 -1
- package/dist/llm-slug-generator.js +49 -49
- package/dist/{logger-D20iS3B-.js → logger-onBePS9K.js} +1 -1
- package/dist/{login-C1_lumKW.js → login-BPzRFY6S.js} +5 -5
- package/dist/{login-qr-D0Gij2UC.js → login-qr-BZbSxC-5.js} +8 -8
- package/dist/{manager-B_QaG_-L.js → manager-D3ROcs7_.js} +9 -9
- package/dist/manager-runtime-Dup90ARI.js +18 -0
- package/dist/{model-selection-Bjj4oU16.js → model-selection-Bh4BR1_K.js} +10 -10
- package/dist/{outbound-ChkqJkiM.js → outbound-BApjXYwN.js} +6 -6
- package/dist/{outbound-attachment-CRXa01xP.js → outbound-attachment-1Yd0-JW2.js} +2 -2
- package/dist/{path-alias-guards-DgNuZPBA.js → path-alias-guards-B63g_1Gb.js} +1 -1
- package/dist/{paths-7EEBmI5a.js → paths-BJWEyNJy.js} +1 -1
- package/dist/{pi-embedded-BoY_A7hg.js → pi-embedded-BPU69pec.js} +50 -50
- package/dist/{pi-embedded-CLTN3qXD.js → pi-embedded-Cajbf_ri.js} +131 -131
- package/dist/{pi-embedded-helpers-1Z1aUoto.js → pi-embedded-helpers-xpgo_nwz.js} +19 -19
- package/dist/{pi-model-discovery-DSuyTtRM.js → pi-model-discovery-BbCPyLm5.js} +1 -1
- package/dist/pi-model-discovery-runtime-BeF5ldX8.js +11 -0
- package/dist/{pi-tools.before-tool-call.runtime-BCq4EKHD.js → pi-tools.before-tool-call.runtime-s89v8h6G.js} +7 -7
- package/dist/plugin-sdk/accounts-BXFDqY90.js +288 -0
- package/dist/plugin-sdk/accounts-DU7Js54-.js +46 -0
- package/dist/plugin-sdk/accounts-DxiB_4z4.js +35 -0
- package/dist/plugin-sdk/active-listener-DRKcesNb.js +50 -0
- package/dist/plugin-sdk/api-key-rotation-k1ZNheUH.js +181 -0
- package/dist/plugin-sdk/audio-preflight-Be1sKsob.js +69 -0
- package/dist/plugin-sdk/audio-transcription-runner-jhHyCc_7.js +2176 -0
- package/dist/plugin-sdk/audit-membership-runtime-B9b-zRwg.js +58 -0
- package/dist/plugin-sdk/channel-activity-Bq1Y9RiB.js +94 -0
- package/dist/plugin-sdk/channel-web-AsdjtnvN.js +2256 -0
- package/dist/plugin-sdk/chrome-DOnBMnlx.js +2415 -0
- package/dist/plugin-sdk/commands-registry-D0py59pz.js +1125 -0
- package/dist/plugin-sdk/config-B16xKqSo.js +17912 -0
- package/dist/plugin-sdk/deliver-BqXXtIuw.js +1694 -0
- package/dist/plugin-sdk/deliver-runtime-D0xZkt8n.js +32 -0
- package/dist/plugin-sdk/deps-send-discord.runtime-BM6ppx2Q.js +23 -0
- package/dist/plugin-sdk/deps-send-imessage.runtime-3w5PhXGu.js +22 -0
- package/dist/plugin-sdk/deps-send-signal.runtime-yH9cQl3_.js +21 -0
- package/dist/plugin-sdk/deps-send-slack.runtime-Bh4gw-L5.js +19 -0
- package/dist/plugin-sdk/deps-send-telegram.runtime-C_CtsWgt.js +24 -0
- package/dist/plugin-sdk/deps-send-whatsapp.runtime-BF4vx9Ho.js +57 -0
- package/dist/plugin-sdk/diagnostic-DUbajFSl.js +319 -0
- package/dist/plugin-sdk/errors-B8oJXuCF.js +54 -0
- package/dist/plugin-sdk/fetch-guard-Cgyq6Jv9.js +156 -0
- package/dist/plugin-sdk/fs-safe-BW1ypSDS.js +352 -0
- package/dist/plugin-sdk/image-BPXnvxYL.js +2310 -0
- package/dist/plugin-sdk/image-ops-BBY2fn9x.js +584 -0
- package/dist/plugin-sdk/image-runtime-S-TzaJpg.js +25 -0
- package/dist/plugin-sdk/imessage.js +2 -2
- package/dist/plugin-sdk/index.js +50 -50
- package/dist/plugin-sdk/ir-BJsqyZfm.js +1296 -0
- package/dist/plugin-sdk/local-roots-C1ETRlaC.js +186 -0
- package/dist/plugin-sdk/logger-DDdrdbDu.js +1163 -0
- package/dist/plugin-sdk/login-DtS9DDnV.js +57 -0
- package/dist/plugin-sdk/login-qr-B9YeeJ37.js +320 -0
- package/dist/plugin-sdk/manager-Dn7j3n0d.js +3917 -0
- package/dist/plugin-sdk/manager-runtime-UK1-iA2B.js +15 -0
- package/dist/plugin-sdk/mattermost.js +3 -3
- package/dist/plugin-sdk/outbound-B8ca8vE3.js +212 -0
- package/dist/plugin-sdk/outbound-attachment-BppFIMQa.js +19 -0
- package/dist/plugin-sdk/path-alias-guards-BX-3FprC.js +43 -0
- package/dist/plugin-sdk/paths-CjFcHB_C.js +166 -0
- package/dist/plugin-sdk/pi-embedded-helpers-BeYjP1MW.js +9627 -0
- package/dist/plugin-sdk/pi-model-discovery-B_qCKuSW.js +134 -0
- package/dist/plugin-sdk/pi-model-discovery-runtime-CZNiNFlm.js +8 -0
- package/dist/plugin-sdk/pi-tools.before-tool-call.runtime-cZdrrV27.js +354 -0
- package/dist/plugin-sdk/plugins-rivB8KaQ.js +864 -0
- package/dist/{proxy-fetch-ChIxNDe3.js → plugin-sdk/proxy-fetch-ZPEvp58f.js} +1 -1
- package/dist/plugin-sdk/pw-ai-qaWZD0yx.js +1938 -0
- package/dist/plugin-sdk/qmd-manager-izn0N9V3.js +1448 -0
- package/dist/plugin-sdk/query-expansion-C1Nx0XAb.js +1011 -0
- package/dist/{redact-BSwbgwaV.js → plugin-sdk/redact-BoNEjbpF.js} +1 -1
- package/dist/plugin-sdk/reply-DNSpho0-.js +98763 -0
- package/dist/plugin-sdk/resolve-outbound-target-YiPIGXVN.js +40 -0
- package/dist/plugin-sdk/run-with-concurrency-vfuRiXdY.js +2023 -0
- package/dist/plugin-sdk/runtime-whatsapp-login.runtime-BgwMJs4X.js +10 -0
- package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-Y7maoii7.js +19 -0
- package/dist/plugin-sdk/send-BSD6Pkrk.js +414 -0
- package/dist/plugin-sdk/send-C4KxEJe1.js +503 -0
- package/dist/plugin-sdk/send-D3XVKGvq.js +540 -0
- package/dist/plugin-sdk/send-DFrnRiWm.js +3135 -0
- package/dist/plugin-sdk/send-Dh1f5xjE.js +2587 -0
- package/dist/plugin-sdk/session-D5c0BIEo.js +169 -0
- package/dist/plugin-sdk/skill-commands-CnqkEfhS.js +342 -0
- package/dist/plugin-sdk/skills-DSbDUvmU.js +1428 -0
- package/dist/plugin-sdk/slack.js +2 -2
- package/dist/plugin-sdk/slash-commands.runtime-Dbtq7ppF.js +13 -0
- package/dist/plugin-sdk/slash-dispatch.runtime-BhAks953.js +52 -0
- package/dist/plugin-sdk/slash-skill-commands.runtime-QGNWVO9S.js +16 -0
- package/dist/plugin-sdk/ssrf-DvsjfpC2.js +202 -0
- package/dist/plugin-sdk/store-DG90hxe6.js +81 -0
- package/dist/plugin-sdk/subagent-registry-runtime-Db83OZ3_.js +52 -0
- package/dist/plugin-sdk/tables-DNlQ8oQ3.js +55 -0
- package/dist/{target-errors-BMTA5KVE.js → plugin-sdk/target-errors-BlVYPwVC.js} +2 -2
- package/dist/plugin-sdk/thinking-DT2ZR60x.js +1206 -0
- package/dist/{tokens-Cdk21tF_.js → plugin-sdk/tokens-CTIYTLWu.js} +1 -1
- package/dist/plugin-sdk/tool-images-DroS1EaM.js +274 -0
- package/dist/plugin-sdk/web-42d5VBZj.js +56 -0
- package/dist/plugin-sdk/whatsapp-actions-DR2aYq5f.js +80 -0
- package/dist/{plugins-D-K4oUXz.js → plugins-D8QbEQB8.js} +6 -6
- package/dist/{proxy-env-D9oPe73i.js → proxy-env-DS2YEWWX.js} +1 -1
- package/dist/proxy-fetch-08-dhqxn.js +38 -0
- package/dist/{pw-ai-4QFtj-s9.js → pw-ai-rD2G8OP-.js} +12 -12
- package/dist/{qmd-manager-CIcyVJmI.js → qmd-manager-B9vC7u4w.js} +9 -9
- package/dist/{query-expansion-BMExPdLO.js → query-expansion-o9Ib6_Rk.js} +4 -4
- package/dist/redact-rnJm_Z5E.js +319 -0
- package/dist/{run-with-concurrency-hJFK7PcO.js → run-with-concurrency-C3dKaL_j.js} +3 -3
- package/dist/runtime-whatsapp-login.runtime-BVm0A03Y.js +13 -0
- package/dist/runtime-whatsapp-outbound.runtime-d8oRCgsW.js +22 -0
- package/dist/{send-DySBiOxg.js → send-6s7HVGcN.js} +7 -7
- package/dist/{send-BMtxl7vL.js → send-BdQyKIzE.js} +5 -5
- package/dist/{send-DJcNRhf_.js → send-CAzswJK6.js} +8 -8
- package/dist/{send-CNzGOCHa.js → send-DKB7vlw3.js} +6 -6
- package/dist/{send-pUHxPU20.js → send-Q5SBsGfY.js} +14 -14
- package/dist/{session-DOFapRIv.js → session-D2CiV8TN.js} +4 -4
- package/dist/{skill-commands-yvTkQtnt.js → skill-commands-CgJiKg3Q.js} +5 -5
- package/dist/{skills-BjHeDO5V.js → skills-DNyMj13y.js} +7 -7
- package/dist/slash-commands.runtime-Cvnjq5gh.js +16 -0
- package/dist/{slash-dispatch.runtime-B79IzyjK.js → slash-dispatch.runtime-UHClfKIh.js} +1 -1
- package/dist/slash-dispatch.runtime-YGQtou1U.js +56 -0
- package/dist/slash-skill-commands.runtime-BbZPUdhN.js +20 -0
- package/dist/{store-C3iBzr-_.js → store-Bdm7wypS.js} +2 -2
- package/dist/{subagent-registry-runtime-CFbDYdKR.js → subagent-registry-runtime-BYDycq2m.js} +1 -1
- package/dist/subagent-registry-runtime-DoZWJdY9.js +56 -0
- package/dist/{subsystem-CWsKV5VU.js → subsystem-BJ89YjCN.js} +2 -2
- package/dist/{tables-Bv8tJ0qC.js → tables-MEAoO_QC.js} +1 -1
- package/dist/target-errors-qetEoXTB.js +195 -0
- package/dist/{thinking-BB_GM390.js → thinking-CaLooOu4.js} +7 -7
- package/dist/tokens-9NF8L9Uh.js +52 -0
- package/dist/{tool-images-HRwkh81U.js → tool-images-CkmNQqHm.js} +2 -2
- package/dist/{web-BUpcF84p.js → web-CGbFuIR9.js} +1 -1
- package/dist/{web-BbpOMti_.js → web-ajuJjPrA.js} +53 -53
- package/dist/{whatsapp-actions-CuLcPfQ9.js → whatsapp-actions-DuJpyhRe.js} +19 -19
- package/dist/{workspace-MO4aE903.js → workspace-CkozFUzc.js} +2 -2
- package/package.json +2 -2
- package/dist/deliver-runtime-BJoBkkm_.js +0 -36
- package/dist/deps-send-discord.runtime-Dlb1pOSn.js +0 -26
- package/dist/deps-send-imessage.runtime-DmVvqFTt.js +0 -25
- package/dist/deps-send-signal.runtime-DPX_GcJK.js +0 -24
- package/dist/deps-send-slack.runtime-s7wb1ssP.js +0 -22
- package/dist/deps-send-telegram.runtime-DcIT4v5p.js +0 -27
- package/dist/deps-send-whatsapp.runtime-DfAhniLS.js +0 -60
- package/dist/image-runtime-Dkwf1-U3.js +0 -29
- package/dist/manager-runtime-DPiPNTWB.js +0 -18
- package/dist/pi-model-discovery-runtime-CRif8A8F.js +0 -11
- package/dist/runtime-whatsapp-login.runtime-DTnmQLV1.js +0 -13
- package/dist/runtime-whatsapp-outbound.runtime-Da-07rzo.js +0 -22
- package/dist/slash-commands.runtime-FS9JZ9BW.js +0 -16
- package/dist/slash-dispatch.runtime-BZw5XlvY.js +0 -56
- package/dist/slash-skill-commands.runtime-BZIbPU6x.js +0 -20
- package/dist/subagent-registry-runtime-Blx4zbr0.js +0 -56
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import "./paths-8xF5kDne.js";
|
|
2
|
+
import { y as isRecord } from "./logger-DDdrdbDu.js";
|
|
3
|
+
import { n as fetchWithTimeout } from "./fetch-timeout-D455O27U.js";
|
|
4
|
+
import { t as makeProxyFetch } from "./proxy-fetch-ZPEvp58f.js";
|
|
5
|
+
import "./proxy-BKdNrmWL.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 { Un as resolveRetryConfig, Wn as retryAsync } from "./config-B16xKqSo.js";
|
|
2
|
+
import { a as createSubsystemLogger } from "./logger-DDdrdbDu.js";
|
|
3
|
+
import { r as formatErrorMessage } from "./errors-B8oJXuCF.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 };
|