openclaw-multi-auto 1.2.5 → 1.2.6
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/{audio-preflight-DDBLZBdb.js → audio-preflight-5FEeDooz.js} +4 -4
- package/dist/{audio-transcription-runner-DZbSWT9E.js → audio-transcription-runner-B-UvoDjZ.js} +1 -1
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{chrome-CMU2WVFh.js → chrome-D45SyhQL.js} +8 -8
- package/dist/{deliver-BXVcFIHL.js → deliver-B9cys0EZ.js} +1 -1
- package/dist/{deliver-runtime-DTaIS-1i.js → deliver-runtime-DhaQJ0pI.js} +3 -3
- package/dist/{deps-send-whatsapp.runtime-CIZqFAqb.js → deps-send-whatsapp.runtime-DvTL2tzN.js} +7 -7
- package/dist/extensionAPI.js +6 -6
- package/dist/{image-BCVLo0qw.js → image-DAOPwVXi.js} +1 -1
- package/dist/{image-runtime-DtCKpMPZ.js → image-runtime-wlCLVvVv.js} +3 -3
- package/dist/{pi-embedded-CgQ_W6Xs.js → pi-embedded-DYU79yGe.js} +24 -24
- package/dist/{pi-embedded-helpers-CwuBTKza.js → pi-embedded-helpers-uTRAmQ4n.js} +3 -3
- package/dist/plugin-sdk/{accounts-C3m65--E.js → accounts-BJAXxY46.js} +2 -2
- package/dist/plugin-sdk/{accounts-CNCCkdEF.js → accounts-C1j7HSL0.js} +3 -3
- package/dist/plugin-sdk/{accounts-BslAlVYS.js → accounts-DyFCXtHv.js} +2 -2
- package/dist/plugin-sdk/{active-listener-CkPnMUkB.js → active-listener-CftX5jLD.js} +2 -2
- package/dist/plugin-sdk/{api-key-rotation-BRE4X2tf.js → api-key-rotation-8nyyt1kx.js} +2 -2
- package/dist/plugin-sdk/{audio-preflight-CtO4fFvp.js → audio-preflight-C_aSAPR1.js} +26 -26
- package/dist/plugin-sdk/{audio-transcription-runner-DnxvOS1-.js → audio-transcription-runner-CB53F7_7.js} +11 -11
- package/dist/plugin-sdk/{audit-membership-runtime-BpfoSk8M.js → audit-membership-runtime-BXndI4LG.js} +2 -2
- package/dist/plugin-sdk/{channel-activity-WJYxcJ3S.js → channel-activity-C5y8AgAV.js} +3 -3
- package/dist/plugin-sdk/{channel-web-dO5k3ubM.js → channel-web-DBTRO03V.js} +18 -18
- package/dist/plugin-sdk/{chrome-CjNTuJML.js → chrome-f00sZkDX.js} +6 -6
- package/dist/plugin-sdk/{commands-registry-CdYjoI0i.js → commands-registry-BJ_NxG2F.js} +4 -4
- package/dist/plugin-sdk/{common-oYc5vPFl.js → common-Cf27Jwxu.js} +2 -2
- package/dist/plugin-sdk/{config-B1z-UxQ3.js → config-CHQrpx-Q.js} +7 -7
- package/dist/plugin-sdk/{deliver-D5_6T567.js → deliver-DNEuetST.js} +10 -10
- package/dist/plugin-sdk/deliver-runtime-BFdqklJM.js +32 -0
- package/dist/plugin-sdk/deps-send-discord.runtime-DuqpYwU0.js +23 -0
- package/dist/plugin-sdk/deps-send-imessage.runtime-CZ2rS8Lb.js +22 -0
- package/dist/plugin-sdk/deps-send-signal.runtime-BdqiWhIh.js +21 -0
- package/dist/plugin-sdk/deps-send-slack.runtime-04s36qiC.js +19 -0
- package/dist/plugin-sdk/deps-send-telegram.runtime-LE5tkPvr.js +24 -0
- package/dist/plugin-sdk/deps-send-whatsapp.runtime-Bz57lobC.js +57 -0
- package/dist/plugin-sdk/{diagnostic-Bxxu0ig-.js → diagnostic-LYUUmjJ5.js} +2 -2
- package/dist/plugin-sdk/{errors-B3cHyZZA.js → errors-CtMWwS2Z.js} +1 -1
- package/dist/plugin-sdk/{fetch-guard-Dcgod0tg.js → fetch-guard-CxYB5Kg6.js} +2 -2
- package/dist/plugin-sdk/{fs-safe-BaKqI3G4.js → fs-safe-DtfhxbrI.js} +3 -3
- package/dist/plugin-sdk/{image-B2mQW9Rb.js → image-BwjYjRHx.js} +6 -6
- package/dist/plugin-sdk/{image-ops-Cbzr4U9l.js → image-ops-BnZKcbd6.js} +2 -2
- package/dist/plugin-sdk/image-runtime-B8twoubs.js +25 -0
- package/dist/plugin-sdk/index.js +50 -50
- package/dist/plugin-sdk/{ir-ZEmrTr4J.js → ir-Z4hX67TJ.js} +7 -7
- package/dist/plugin-sdk/{local-roots-CIPRxA-4.js → local-roots-KhjQw04O.js} +4 -4
- package/dist/plugin-sdk/{logger-CvPFVOgT.js → logger-DHIIvMxj.js} +2 -2
- package/dist/plugin-sdk/{login-CCTew9bt.js → login-C31642Ld.js} +4 -4
- package/dist/plugin-sdk/{login-qr-BI3Vi_wJ.js → login-qr--y2SG_Ue.js} +5 -5
- package/dist/plugin-sdk/{manager-BEoYPn7R.js → manager-2UZBMCc7.js} +8 -8
- package/dist/plugin-sdk/manager-runtime-CMeLwose.js +15 -0
- package/dist/plugin-sdk/{outbound-ByOw1K6W.js → outbound-Ba0QUI5h.js} +5 -5
- package/dist/plugin-sdk/{outbound-attachment-BzVhxRRw.js → outbound-attachment-B1Laso-8.js} +2 -2
- package/dist/plugin-sdk/{path-alias-guards-DBjLbIX_.js → path-alias-guards-C7Vm5DZ1.js} +1 -1
- package/dist/plugin-sdk/{paths-Dpg3qxcl.js → paths-DopV9PQG.js} +1 -1
- package/dist/plugin-sdk/{pi-embedded-helpers-DIxXkGJf.js → pi-embedded-helpers-DnA_OCzP.js} +16 -16
- package/dist/plugin-sdk/{pi-model-discovery-DM_2uFtj.js → pi-model-discovery-DdPqXk8f.js} +1 -1
- package/dist/plugin-sdk/pi-model-discovery-runtime-D8CJhtJY.js +8 -0
- package/dist/plugin-sdk/{pi-tools.before-tool-call.runtime-w1dqL_ty.js → pi-tools.before-tool-call.runtime-DxFHiLUE.js} +4 -4
- package/dist/plugin-sdk/{plugins-C4USiH29.js → plugins-CbCt4osF.js} +4 -4
- package/dist/plugin-sdk/{proxy-env-ET-rp8eg.js → proxy-env-C63mMdas.js} +1 -1
- package/dist/plugin-sdk/{proxy-fetch-ChxOhWF4.js → proxy-fetch-Ch95c_Y2.js} +1 -1
- package/dist/plugin-sdk/{pw-ai-CyOt3RDA.js → pw-ai-DpJk62D4.js} +9 -9
- package/dist/plugin-sdk/{qmd-manager-BySdoVR7.js → qmd-manager-Ca-iSfEE.js} +7 -7
- package/dist/plugin-sdk/{query-expansion-C6uS-7lj.js → query-expansion-B_Xe41Ab.js} +4 -4
- package/dist/plugin-sdk/{redact-DjVX-1N3.js → redact-hp9TOulW.js} +1 -1
- package/dist/plugin-sdk/{reply-CTCSeQqW.js → reply-CovBlFea.js} +73 -73
- package/dist/plugin-sdk/{resolve-outbound-target-Bw8YNANu.js → resolve-outbound-target-BbrHgyUk.js} +2 -2
- package/dist/plugin-sdk/{run-with-concurrency-C_KCHwvf.js → run-with-concurrency-BR1DXa8T.js} +1 -1
- package/dist/plugin-sdk/runtime-whatsapp-login.runtime-SkO91TZH.js +10 -0
- package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-B0VWK5hm.js +19 -0
- package/dist/plugin-sdk/{send-C0w6xP2x.js → send-BTztm3D2.js} +6 -6
- package/dist/plugin-sdk/{send-qPyNGSe4.js → send-BXpXBwM_.js} +13 -13
- package/dist/plugin-sdk/{send-BZ6nYFZr.js → send-BvAtLLPl.js} +5 -5
- package/dist/plugin-sdk/{send-CFf-1V89.js → send-CWJUuG0i.js} +8 -8
- package/dist/plugin-sdk/{send-CY-Qfwia.js → send-EcglC4cG.js} +7 -7
- package/dist/plugin-sdk/{session-COrvpvUQ.js → session-k256LJZT.js} +3 -3
- package/dist/plugin-sdk/{skill-commands-DZqhtmiv.js → skill-commands-DoRqLzxm.js} +4 -4
- package/dist/plugin-sdk/{skills-Cw_vXEJb.js → skills-QudILG6e.js} +6 -6
- package/dist/plugin-sdk/slash-commands.runtime-DS6vCNSL.js +13 -0
- package/dist/plugin-sdk/slash-dispatch.runtime-BXrxb2wd.js +52 -0
- package/dist/plugin-sdk/slash-skill-commands.runtime-Bd6qQ2oT.js +16 -0
- package/dist/plugin-sdk/{store-CMHj6IIw.js → store-BbDQw3g6.js} +2 -2
- package/dist/plugin-sdk/subagent-registry-runtime-1uwQbuXj.js +52 -0
- package/dist/plugin-sdk/{tables-CSqrHsKL.js → tables-BhvloMKN.js} +1 -1
- package/dist/plugin-sdk/{thinking-DOnsR_A8.js → thinking-URzkT-3p.js} +7 -7
- package/dist/plugin-sdk/{tokens-DgNRBwIg.js → tokens-B1PW5Ayy.js} +1 -1
- package/dist/plugin-sdk/{tool-images-Gk_-0y2N.js → tool-images-xpqbP6RR.js} +2 -2
- package/dist/plugin-sdk/web-B74yhL2N.js +56 -0
- package/dist/plugin-sdk/{whatsapp-actions-xcleMoMv.js → whatsapp-actions-RcZ6vp61.js} +17 -17
- package/dist/plugin-sdk/whatsapp.js +50 -50
- package/dist/{pw-ai-CmphSzHx.js → pw-ai-GcYO6HPE.js} +1 -1
- package/dist/{slash-dispatch.runtime-131yup2e.js → slash-dispatch.runtime-Dh053pQK.js} +6 -6
- package/dist/{subagent-registry-runtime-DbSf_Je6.js → subagent-registry-runtime-DSi5mnCQ.js} +6 -6
- package/dist/{web-MR9d7KyB.js → web-1hWJDzNA.js} +6 -6
- package/package.json +1 -1
- package/scripts/create-instance.sh +104 -71
- package/dist/plugin-sdk/accounts-CJWOBzwB.js +0 -35
- package/dist/plugin-sdk/accounts-DP1-L-QS.js +0 -288
- package/dist/plugin-sdk/accounts-DZhWlEg3.js +0 -46
- package/dist/plugin-sdk/active-listener-B_sLJTXM.js +0 -50
- package/dist/plugin-sdk/api-key-rotation-BXnNsojA.js +0 -181
- package/dist/plugin-sdk/audio-preflight-DGEUDxxR.js +0 -69
- package/dist/plugin-sdk/audio-transcription-runner-DkoPNPYt.js +0 -2176
- package/dist/plugin-sdk/audit-membership-runtime-DSBHHw7o.js +0 -58
- package/dist/plugin-sdk/channel-activity-F3d0yUwy.js +0 -94
- package/dist/plugin-sdk/channel-web-QF7EpjeP.js +0 -2256
- package/dist/plugin-sdk/chrome-BXoCyCkY.js +0 -2415
- package/dist/plugin-sdk/commands-registry-t7cXBTfN.js +0 -1125
- package/dist/plugin-sdk/config-BkEnz2Po.js +0 -17913
- package/dist/plugin-sdk/deliver-B6AG_l67.js +0 -1694
- package/dist/plugin-sdk/deliver-runtime-C5dgvvga.js +0 -32
- package/dist/plugin-sdk/deliver-runtime-D585kJZc.js +0 -32
- package/dist/plugin-sdk/deps-send-discord.runtime-Dg4N7PHJ.js +0 -23
- package/dist/plugin-sdk/deps-send-discord.runtime-a_OKY2js.js +0 -23
- package/dist/plugin-sdk/deps-send-imessage.runtime-0OEwzMQm.js +0 -22
- package/dist/plugin-sdk/deps-send-imessage.runtime-Baxy9TD4.js +0 -22
- package/dist/plugin-sdk/deps-send-signal.runtime-BM1jRt3G.js +0 -21
- package/dist/plugin-sdk/deps-send-signal.runtime-BwXoCrFl.js +0 -21
- package/dist/plugin-sdk/deps-send-slack.runtime-1E3BYRdF.js +0 -19
- package/dist/plugin-sdk/deps-send-slack.runtime-CLmKjgso.js +0 -19
- package/dist/plugin-sdk/deps-send-telegram.runtime-BKfdBKnZ.js +0 -24
- package/dist/plugin-sdk/deps-send-telegram.runtime-DNCxIflA.js +0 -24
- package/dist/plugin-sdk/deps-send-whatsapp.runtime-BOTwkbx_.js +0 -57
- package/dist/plugin-sdk/deps-send-whatsapp.runtime-OLwr-9c8.js +0 -57
- package/dist/plugin-sdk/diagnostic-CsP-lEkI.js +0 -319
- package/dist/plugin-sdk/errors-DaiAM-yU.js +0 -54
- package/dist/plugin-sdk/fetch-guard-DETCcJzQ.js +0 -156
- package/dist/plugin-sdk/fs-safe-B8y811FR.js +0 -352
- package/dist/plugin-sdk/image-DjTEkYZE.js +0 -2310
- package/dist/plugin-sdk/image-ops-BSiMpAw4.js +0 -584
- package/dist/plugin-sdk/image-runtime-6xPp8m5a.js +0 -25
- package/dist/plugin-sdk/image-runtime-BFm45j49.js +0 -25
- package/dist/plugin-sdk/ir-DQ7_HbvK.js +0 -1296
- package/dist/plugin-sdk/local-roots-BUP4YBmR.js +0 -186
- package/dist/plugin-sdk/logger-CZY9KIoY.js +0 -1163
- package/dist/plugin-sdk/login-BxEKLlCo.js +0 -57
- package/dist/plugin-sdk/login-qr-BQIpMPr9.js +0 -320
- package/dist/plugin-sdk/manager-I6KbPihW.js +0 -3917
- package/dist/plugin-sdk/manager-runtime-CFfYYWIQ.js +0 -15
- package/dist/plugin-sdk/manager-runtime-DxclHQ4U.js +0 -15
- package/dist/plugin-sdk/outbound-NS6UHnB6.js +0 -212
- package/dist/plugin-sdk/outbound-attachment-Dy6fyf6H.js +0 -19
- package/dist/plugin-sdk/path-alias-guards-sWayacde.js +0 -43
- package/dist/plugin-sdk/paths-vTM3Lh3X.js +0 -166
- package/dist/plugin-sdk/pi-embedded-helpers-1R1gu7eX.js +0 -9627
- package/dist/plugin-sdk/pi-model-discovery-runtime-BuzvkvNR.js +0 -8
- package/dist/plugin-sdk/pi-model-discovery-runtime-Do9o-dUd.js +0 -8
- package/dist/plugin-sdk/pi-model-discovery-v-XPUOOf.js +0 -134
- package/dist/plugin-sdk/pi-tools.before-tool-call.runtime-D4sFsIks.js +0 -354
- package/dist/plugin-sdk/plugins-DeBZB9l_.js +0 -864
- package/dist/plugin-sdk/proxy-fetch-uDXGKG3Z.js +0 -38
- package/dist/plugin-sdk/pw-ai-DEOmCSSC.js +0 -1938
- package/dist/plugin-sdk/qmd-manager-HyYKoEch.js +0 -1448
- package/dist/plugin-sdk/query-expansion-CeyKUeDW.js +0 -1011
- package/dist/plugin-sdk/redact-Bvxt1T_Q.js +0 -319
- package/dist/plugin-sdk/reply-DAo_Jt8K.js +0 -97916
- package/dist/plugin-sdk/resolve-outbound-target-B42qgQS9.js +0 -40
- package/dist/plugin-sdk/run-with-concurrency-Bt_ks0Qa.js +0 -1994
- package/dist/plugin-sdk/runtime-whatsapp-login.runtime-B6W989eF.js +0 -10
- package/dist/plugin-sdk/runtime-whatsapp-login.runtime-BxgRDkhc.js +0 -10
- package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-c_GDFy37.js +0 -19
- package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-elOqrkfg.js +0 -19
- package/dist/plugin-sdk/send-CQpMudwO.js +0 -2587
- package/dist/plugin-sdk/send-DQHLzVyO.js +0 -414
- package/dist/plugin-sdk/send-DTB24bEF.js +0 -3135
- package/dist/plugin-sdk/send-DfHadjZ_.js +0 -503
- package/dist/plugin-sdk/send-XXlW2iny.js +0 -540
- package/dist/plugin-sdk/session-6TF6MyaC.js +0 -169
- package/dist/plugin-sdk/skill-commands-CkGeFUMl.js +0 -342
- package/dist/plugin-sdk/skills-CBkHBYPq.js +0 -1428
- package/dist/plugin-sdk/slash-commands.runtime-CxliuGaP.js +0 -13
- package/dist/plugin-sdk/slash-commands.runtime-D67JLweo.js +0 -13
- package/dist/plugin-sdk/slash-dispatch.runtime-DFaeYlJQ.js +0 -52
- package/dist/plugin-sdk/slash-dispatch.runtime-DvcpvCJ0.js +0 -52
- package/dist/plugin-sdk/slash-skill-commands.runtime-0M0OLCxq.js +0 -16
- package/dist/plugin-sdk/slash-skill-commands.runtime-BM1x3azR.js +0 -16
- package/dist/plugin-sdk/ssrf-cFtplYtS.js +0 -202
- package/dist/plugin-sdk/store-5nyxY3WU.js +0 -81
- package/dist/plugin-sdk/subagent-registry-runtime-1lbDyRzz.js +0 -52
- package/dist/plugin-sdk/subagent-registry-runtime-DCtmDwna.js +0 -52
- package/dist/plugin-sdk/tables-C47P4GTN.js +0 -55
- package/dist/plugin-sdk/target-errors-Blia4S69.js +0 -195
- package/dist/plugin-sdk/thinking-Bo2eosVa.js +0 -1206
- package/dist/plugin-sdk/tokens-BDr0Z9o3.js +0 -52
- package/dist/plugin-sdk/tool-images-eEfOVkzf.js +0 -274
- package/dist/plugin-sdk/web-BLyT64pW.js +0 -56
- package/dist/plugin-sdk/web-CVxZbXyH.js +0 -56
- package/dist/plugin-sdk/whatsapp-actions-Bw0H9g-n.js +0 -80
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import "./paths-MKyEVmEb.js";
|
|
2
|
-
import { y as isRecord } from "./logger-CZY9KIoY.js";
|
|
3
|
-
import { n as fetchWithTimeout } from "./fetch-timeout-D455O27U.js";
|
|
4
|
-
import { t as makeProxyFetch } from "./proxy-fetch-ChxOhWF4.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 };
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { Un as resolveRetryConfig, Wn as retryAsync } from "./config-BkEnz2Po.js";
|
|
2
|
-
import { a as createSubsystemLogger } from "./logger-CZY9KIoY.js";
|
|
3
|
-
import { r as formatErrorMessage } from "./errors-DaiAM-yU.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 };
|