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

推荐订阅源

B
Blog
D
Docker
J
Java Code Geeks
腾讯CDC
Blog — PlanetScale
Blog — PlanetScale
G
Google Developers Blog
M
MIT News - Artificial intelligence
L
LangChain Blog
T
The Blog of Author Tim Ferriss
P
Proofpoint News Feed
MyScale Blog
MyScale Blog
博客园 - Franky
GbyAI
GbyAI
Hugging Face - Blog
Hugging Face - Blog
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东
N
Netflix TechBlog - Medium
B
Blog RSS Feed
Y
Y Combinator Blog
阮一峰的网络日志
阮一峰的网络日志
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News

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
test: tighten media apply cli assertions · openclaw/openc...
steipete · 2026-05-09 · via Recent Commits to openclaw:main

@@ -6,6 +6,7 @@ import type { MsgContext } from "../auto-reply/templating.js";

66

import type { OpenClawConfig } from "../config/types.js";

77

import { resolvePreferredOpenClawTmpDir } from "../infra/tmp-openclaw-dir.js";

88

import { withEnvAsync } from "../test-utils/env.js";

9+

import { CLI_OUTPUT_MAX_BUFFER } from "./defaults.constants.js";

910

import { createSafeAudioFixtureBuffer } from "./runner.test-utils.js";

1011

import type { MediaUnderstandingProvider } from "./types.js";

1112

@@ -106,6 +107,29 @@ function expectTranscriptApplied(params: {

106107

expect(params.ctx.BodyForCommands).toBe(params.commandBody);

107108

}

108109110+

function getRunExecCall(index = 0) {

111+

const call = mockedRunExec.mock.calls[index];

112+

if (!call) {

113+

throw new Error(`expected runExec call ${index}`);

114+

}

115+

return call;

116+

}

117+118+

function getRunFfmpegArgs(index = 0) {

119+

const [args] = mockedRunFfmpeg.mock.calls[index] ?? [];

120+

if (!Array.isArray(args)) {

121+

throw new Error(`expected runFfmpeg args ${index}`);

122+

}

123+

return args;

124+

}

125+126+

function expectCliRunOptions(options: unknown) {

127+

expect(options).toEqual({

128+

timeoutMs: 60_000,

129+

maxBuffer: CLI_OUTPUT_MAX_BUFFER,

130+

});

131+

}

132+109133

function createMediaDisabledConfig(): OpenClawConfig {

110134

return {

111135

tools: {

@@ -735,11 +759,16 @@ describe("applyMediaUnderstanding", () => {

735759

);

736760737761

expect(ctx.Transcript).toBe("sherpa ok");

738-

expect(mockedRunExec).toHaveBeenCalledWith(

739-

"sherpa-onnx-offline",

740-

expect.any(Array),

741-

expect.any(Object),

742-

);

762+

const [command, args, options] = getRunExecCall();

763+

expect(command).toBe("sherpa-onnx-offline");

764+

expect(args).toEqual([

765+

`--tokens=${path.join(modelDir, "tokens.txt")}`,

766+

`--encoder=${path.join(modelDir, "encoder.onnx")}`,

767+

`--decoder=${path.join(modelDir, "decoder.onnx")}`,

768+

`--joiner=${path.join(modelDir, "joiner.onnx")}`,

769+

await fs.realpath(ctx.MediaPath ?? ""),

770+

]);

771+

expectCliRunOptions(options);

743772

});

744773745774

it("auto-detects whisper-cli when sherpa is unavailable", async () => {

@@ -764,11 +793,16 @@ describe("applyMediaUnderstanding", () => {

764793

);

765794766795

expect(ctx.Transcript).toBe("whisper cpp ok");

767-

expect(mockedRunExec).toHaveBeenCalledWith(

768-

"whisper-cli",

769-

expect.any(Array),

770-

expect.any(Object),

771-

);

796+

const [command, args, options] = getRunExecCall();

797+

expect(command).toBe("whisper-cli");

798+

if (!Array.isArray(args)) {

799+

throw new Error("expected whisper-cli args");

800+

}

801+

expect(args.slice(0, 4)).toEqual(["-m", modelPath, "-otxt", "-of"]);

802+

expect(typeof args[4]).toBe("string");

803+

expect(String(args[4]).endsWith("sample")).toBe(true);

804+

expect(args.slice(5)).toEqual(["-np", "-nt", await fs.realpath(ctx.MediaPath ?? "")]);

805+

expectCliRunOptions(options);

772806

});

773807774808

it("transcodes non-wav audio before auto-detected whisper-cli runs", async () => {

@@ -811,24 +845,23 @@ describe("applyMediaUnderstanding", () => {

811845

);

812846813847

expect(ctx.Transcript).toBe("whisper cpp ogg ok");

814-

expect(mockedRunFfmpeg).toHaveBeenCalledWith(

815-

expect.arrayContaining([

816-

"-i",

817-

expect.stringMatching(/telegram-voice\.ogg$/),

818-

"-ac",

819-

"1",

820-

"-ar",

821-

"16000",

822-

"-c:a",

823-

"pcm_s16le",

824-

expect.stringMatching(/telegram-voice\.wav.*\.part$/),

825-

]),

826-

);

827-

expect(mockedRunExec).toHaveBeenCalledWith(

828-

"whisper-cli",

829-

expect.arrayContaining([expect.stringMatching(/telegram-voice\.wav$/)]),

830-

expect.any(Object),

831-

);

848+

const ffmpegArgs = getRunFfmpegArgs();

849+

expect(ffmpegArgs).toHaveLength(10);

850+

expect(ffmpegArgs.slice(0, 2)).toEqual(["-y", "-i"]);

851+

expect(String(ffmpegArgs[2]).endsWith("telegram-voice.ogg")).toBe(true);

852+

expect(ffmpegArgs.slice(3, 9)).toEqual(["-ac", "1", "-ar", "16000", "-c:a", "pcm_s16le"]);

853+

expect(String(ffmpegArgs[9]).includes("telegram-voice.wav")).toBe(true);

854+

expect(String(ffmpegArgs[9]).endsWith(".part")).toBe(true);

855+856+

const [command, args, options] = getRunExecCall();

857+

expect(command).toBe("whisper-cli");

858+

if (!Array.isArray(args)) {

859+

throw new Error("expected whisper-cli transcode args");

860+

}

861+

expect(args.slice(0, 4)).toEqual(["-m", modelPath, "-otxt", "-of"]);

862+

expect(args.slice(5, 7)).toEqual(["-np", "-nt"]);

863+

expect(String(args[7]).endsWith("telegram-voice.wav")).toBe(true);

864+

expectCliRunOptions(options);

832865

});

833866834867

it("skips audio auto-detect when no supported binaries or provider keys are available", async () => {