refactor: move telegram timing helpers onto runtime-env

This commit is contained in:
Peter Steinberger
2026-03-28 02:43:00 +00:00
parent 71f37a59ca
commit b171e42117
5 changed files with 11 additions and 6 deletions

View File

@@ -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,

View File

@@ -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,

View File

@@ -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";

View File

@@ -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;

View File

@@ -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";