mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-30 03:11:10 +00:00
refactor: move telegram timing helpers onto runtime-env
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import path from "node:path";
|
||||
import { GrammyError } from "grammy";
|
||||
import { retryAsync } from "openclaw/plugin-sdk/infra-runtime";
|
||||
import { fetchRemoteMedia } from "openclaw/plugin-sdk/media-runtime";
|
||||
import { saveMediaBuffer } from "openclaw/plugin-sdk/media-runtime";
|
||||
import { logVerbose, warn } from "openclaw/plugin-sdk/runtime-env";
|
||||
import { retryAsync } from "openclaw/plugin-sdk/runtime-env";
|
||||
import { formatErrorMessage } from "openclaw/plugin-sdk/ssrf-runtime";
|
||||
import {
|
||||
resolveTelegramApiBase,
|
||||
|
||||
@@ -22,8 +22,8 @@ vi.mock("./api-logging.js", () => ({
|
||||
withTelegramApiErrorLogging: async ({ fn }: { fn: () => Promise<unknown> }) => await fn(),
|
||||
}));
|
||||
|
||||
vi.mock("openclaw/plugin-sdk/infra-runtime", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("openclaw/plugin-sdk/infra-runtime")>();
|
||||
vi.mock("openclaw/plugin-sdk/runtime-env", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("openclaw/plugin-sdk/runtime-env")>();
|
||||
return {
|
||||
...actual,
|
||||
computeBackoff: computeBackoffMock,
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { type RunOptions, run } from "@grammyjs/runner";
|
||||
import { computeBackoff, sleepWithAbort } from "openclaw/plugin-sdk/infra-runtime";
|
||||
import { formatDurationPrecise } from "openclaw/plugin-sdk/infra-runtime";
|
||||
import {
|
||||
computeBackoff,
|
||||
formatDurationPrecise,
|
||||
sleepWithAbort,
|
||||
} from "openclaw/plugin-sdk/runtime-env";
|
||||
import { formatErrorMessage } from "openclaw/plugin-sdk/ssrf-runtime";
|
||||
import { withTelegramApiErrorLogging } from "./api-logging.js";
|
||||
import { createTelegramBot } from "./bot.js";
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
computeBackoff,
|
||||
sleepWithAbort,
|
||||
type BackoffPolicy,
|
||||
} from "openclaw/plugin-sdk/infra-runtime";
|
||||
} from "openclaw/plugin-sdk/runtime-env";
|
||||
|
||||
export type TelegramSendChatActionLogger = (message: string) => void;
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ export {
|
||||
export { isTruthyEnvValue } from "../infra/env.js";
|
||||
export * from "../logging.js";
|
||||
export { waitForAbortSignal } from "../infra/abort-signal.js";
|
||||
export { computeBackoff, sleepWithAbort, type BackoffPolicy } from "../infra/backoff.js";
|
||||
export { formatDurationPrecise } from "../infra/format-time/format-duration.ts";
|
||||
export { retryAsync } from "../infra/retry.js";
|
||||
export { ensureGlobalUndiciEnvProxyDispatcher } from "../infra/net/undici-global-dispatcher.js";
|
||||
export { registerUnhandledRejectionHandler } from "../infra/unhandled-rejections.js";
|
||||
|
||||
Reference in New Issue
Block a user