惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
Stack Overflow Blog
Stack Overflow Blog
B
Blog RSS Feed
C
Check Point Blog
D
Docker
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
博客园_首页
Apple Machine Learning Research
Apple Machine Learning Research
量子位
有赞技术团队
有赞技术团队
IT之家
IT之家
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
M
MIT News - Artificial intelligence
B
Blog
阮一峰的网络日志
阮一峰的网络日志
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
腾讯CDC
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
V2EX
月光博客
月光博客

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(telegram): probe video dimensions through sdk · openc...
storyarcade · 2026-04-29 · via Recent Commits to openclaw:main

@@ -4,6 +4,9 @@ import { beforeEach, describe, expect, it, vi } from "vitest";

44

const { loadWebMedia } = vi.hoisted(() => ({

55

loadWebMedia: vi.fn(),

66

}));

7+

const { probeVideoDimensions } = vi.hoisted(() => ({

8+

probeVideoDimensions: vi.fn(),

9+

}));

710

const triggerInternalHook = vi.hoisted(() => vi.fn(async () => {}));

811

const messageHookRunner = vi.hoisted(() => ({

912

hasHooks: vi.fn<(name: string) => boolean>(() => false),

@@ -28,6 +31,14 @@ vi.mock("openclaw/plugin-sdk/web-media", () => ({

2831

loadWebMedia: (...args: unknown[]) => loadWebMedia(...args),

2932

}));

303334+

vi.mock("openclaw/plugin-sdk/media-runtime", async (importOriginal) => {

35+

const actual = await importOriginal<typeof import("openclaw/plugin-sdk/media-runtime")>();

36+

return {

37+

...actual,

38+

probeVideoDimensions,

39+

};

40+

});

41+3142

vi.mock("openclaw/plugin-sdk/hook-runtime", async (importOriginal) => {

3243

const actual = await importOriginal<typeof import("openclaw/plugin-sdk/hook-runtime")>();

3344

return {

@@ -135,6 +146,8 @@ function createVoiceFailureHarness(params: {

135146

describe("deliverReplies", () => {

136147

beforeEach(() => {

137148

loadWebMedia.mockClear();

149+

probeVideoDimensions.mockReset();

150+

probeVideoDimensions.mockResolvedValue(undefined);

138151

triggerInternalHook.mockReset();

139152

messageHookRunner.hasHooks.mockReset();

140153

messageHookRunner.hasHooks.mockReturnValue(false);

@@ -489,6 +502,63 @@ describe("deliverReplies", () => {

489502

);

490503

});

491504505+

it("passes probed dimensions to video reply sends", async () => {

506+

const runtime = createRuntime();

507+

const sendVideo = vi.fn().mockResolvedValue({

508+

message_id: 22,

509+

chat: { id: "123" },

510+

});

511+

const bot = createBot({ sendVideo });

512+

probeVideoDimensions.mockResolvedValueOnce({ width: 720, height: 1280 });

513+514+

mockMediaLoad("video.mp4", "video/mp4", "video");

515+516+

await deliverWith({

517+

replies: [{ mediaUrl: "https://example.com/video.mp4", text: "hi **boss**" }],

518+

runtime,

519+

bot,

520+

});

521+522+

expect(probeVideoDimensions).toHaveBeenCalledWith(Buffer.from("video"));

523+

expect(sendVideo).toHaveBeenCalledWith(

524+

"123",

525+

expect.anything(),

526+

expect.objectContaining({

527+

caption: "hi <b>boss</b>",

528+

parse_mode: "HTML",

529+

width: 720,

530+

height: 1280,

531+

}),

532+

);

533+

});

534+535+

it("does not probe GIF reply animations", async () => {

536+

const runtime = createRuntime();

537+

const sendAnimation = vi.fn().mockResolvedValue({

538+

message_id: 23,

539+

chat: { id: "123" },

540+

});

541+

const bot = createBot({ sendAnimation });

542+543+

mockMediaLoad("fun.gif", "image/gif", "GIF89a");

544+545+

await deliverWith({

546+

replies: [{ mediaUrl: "https://example.com/fun.gif", text: "gif" }],

547+

runtime,

548+

bot,

549+

});

550+551+

expect(probeVideoDimensions).not.toHaveBeenCalled();

552+

expect(sendAnimation).toHaveBeenCalledWith(

553+

"123",

554+

expect.anything(),

555+

expect.not.objectContaining({

556+

width: expect.any(Number),

557+

height: expect.any(Number),

558+

}),

559+

);

560+

});

561+492562

it("passes mediaLocalRoots to media loading", async () => {

493563

const runtime = createRuntime();

494564

const sendPhoto = vi.fn().mockResolvedValue({