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

推荐订阅源

MyScale Blog
MyScale Blog
Apple Machine Learning Research
Apple Machine Learning Research
H
Help Net Security
雷峰网
雷峰网
V
Visual Studio Blog
G
Google Developers Blog
Microsoft Azure Blog
Microsoft Azure Blog
Hugging Face - Blog
Hugging Face - Blog
爱范儿
爱范儿
IT之家
IT之家
Engineering at Meta
Engineering at Meta
Microsoft Security Blog
Microsoft Security Blog
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
M
MIT News - Artificial intelligence
月光博客
月光博客
A
About on SuperTechFans
B
Blog RSS Feed
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The GitHub Blog
The GitHub Blog
N
Netflix TechBlog - Medium
J
Java Code Geeks
云风的 BLOG
云风的 BLOG
Blog — PlanetScale
Blog — PlanetScale

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(messages): apply tts before message-tool sends (#8354...
steipete · 2026-05-18 · via Recent Commits to openclaw:main

@@ -90,6 +90,7 @@ const mocks = vi.hoisted(() => ({

9090

executePollAction: vi.fn(),

9191

callGatewayLeastPrivilege: vi.fn(),

9292

randomIdempotencyKey: vi.fn(() => "idem-gateway-action"),

93+

maybeApplyTtsToPayload: vi.fn(async (params: { payload: unknown }) => params.payload),

9394

}));

94959596

vi.mock("./channel-resolution.js", () => ({

@@ -107,6 +108,10 @@ vi.mock("./message.gateway.runtime.js", () => ({

107108

randomIdempotencyKey: mocks.randomIdempotencyKey,

108109

}));

109110111+

vi.mock("../../tts/tts.runtime.js", () => ({

112+

maybeApplyTtsToPayload: mocks.maybeApplyTtsToPayload,

113+

}));

114+110115

vi.mock("./outbound-session.js", () => ({

111116

ensureOutboundSessionEntry: vi.fn(async () => undefined),

112117

resolveOutboundSessionRoute: vi.fn(async () => null),

@@ -268,6 +273,10 @@ describe("runMessageAction plugin dispatch", () => {

268273

);

269274

mocks.callGatewayLeastPrivilege.mockReset();

270275

mocks.randomIdempotencyKey.mockClear();

276+

mocks.maybeApplyTtsToPayload.mockReset();

277+

mocks.maybeApplyTtsToPayload.mockImplementation(

278+

async (params: { payload: unknown }) => params.payload,

279+

);

271280

});

272281273282

describe("alias-based plugin action dispatch", () => {

@@ -697,6 +706,151 @@ describe("runMessageAction plugin dispatch", () => {

697706

);

698707

});

699708709+

it("applies TTS before gateway-executed plugin sends", async () => {

710+

const gatewayPlugin = createGatewayActionPlugin({

711+

pluginId: "gatewaychat",

712+

label: "Gateway Chat",

713+

blurb: "Gateway Chat send test plugin.",

714+

actions: ["send"],

715+

messaging: {

716+

targetResolver: {

717+

looksLikeId: () => true,

718+

},

719+

},

720+

handleAction: vi.fn(async () => jsonResult({ ok: true, local: true })),

721+

});

722+

setActivePluginRegistry(

723+

createTestRegistry([

724+

{

725+

pluginId: "gatewaychat",

726+

source: "test",

727+

plugin: gatewayPlugin,

728+

},

729+

]),

730+

);

731+

mocks.callGatewayLeastPrivilege.mockResolvedValue({

732+

ok: true,

733+

messageId: "gw-send-tts",

734+

});

735+

mocks.maybeApplyTtsToPayload.mockResolvedValueOnce({

736+

mediaUrl: "file:///tmp/openclaw-voice.ogg",

737+

audioAsVoice: true,

738+

spokenText: "hello there",

739+

});

740+741+

await runMessageAction({

742+

cfg: {

743+

channels: {

744+

gatewaychat: {

745+

enabled: true,

746+

},

747+

},

748+

messages: {

749+

tts: {

750+

auto: "tagged",

751+

},

752+

},

753+

} as OpenClawConfig,

754+

action: "send",

755+

params: {

756+

channel: "gatewaychat",

757+

target: "user-123",

758+

message: "[[tts:text]]hello there[[/tts:text]]",

759+

},

760+

gateway: {

761+

clientName: "cli",

762+

mode: "cli",

763+

},

764+

dryRun: false,

765+

});

766+767+

const gatewayCall = readMockCallArg(

768+

mocks.callGatewayLeastPrivilege,

769+

"gateway least privilege call",

770+

);

771+

const gatewayParams = readRecordField(gatewayCall, "params", "gateway call params");

772+

expectRecordFields(

773+

readRecordField(gatewayParams, "params", "gateway message params"),

774+

{

775+

message: "",

776+

media: "file:///tmp/openclaw-voice.ogg",

777+

mediaUrl: "file:///tmp/openclaw-voice.ogg",

778+

asVoice: true,

779+

audioAsVoice: true,

780+

},

781+

"gateway message params",

782+

);

783+

expect(mocks.executeSendAction).not.toHaveBeenCalled();

784+

});

785+786+

it("applies TTS before local plugin send fallback dispatch", async () => {

787+

const handleAction = vi.fn(async ({ params }: { params: Record<string, unknown> }) =>

788+

jsonResult({ ok: true, params }),

789+

);

790+

const localPlugin = createGatewayActionPlugin({

791+

pluginId: "localchat",

792+

label: "Local Chat",

793+

blurb: "Local Chat send test plugin.",

794+

actions: ["send"],

795+

gatewayActions: [],

796+

messaging: {

797+

targetResolver: {

798+

looksLikeId: () => true,

799+

},

800+

},

801+

handleAction,

802+

});

803+

setActivePluginRegistry(

804+

createTestRegistry([

805+

{

806+

pluginId: "localchat",

807+

source: "test",

808+

plugin: localPlugin,

809+

},

810+

]),

811+

);

812+

mocks.maybeApplyTtsToPayload.mockResolvedValueOnce({

813+

mediaUrl: "file:///tmp/openclaw-voice.ogg",

814+

audioAsVoice: true,

815+

spokenText: "hello there",

816+

});

817+818+

await runMessageAction({

819+

cfg: {

820+

channels: {

821+

localchat: {

822+

enabled: true,

823+

},

824+

},

825+

messages: {

826+

tts: {

827+

auto: "tagged",

828+

},

829+

},

830+

} as OpenClawConfig,

831+

action: "send",

832+

params: {

833+

channel: "localchat",

834+

target: "user-123",

835+

message: "[[tts:text]]hello there[[/tts:text]]",

836+

},

837+

dryRun: false,

838+

});

839+840+

const call = readFirstPluginCall(handleAction);

841+

expectRecordFields(

842+

readRecordField(call, "params", "local plugin params"),

843+

{

844+

message: "",

845+

media: "file:///tmp/openclaw-voice.ogg",

846+

mediaUrl: "file:///tmp/openclaw-voice.ogg",

847+

asVoice: true,

848+

audioAsVoice: true,

849+

},

850+

"local plugin params",

851+

);

852+

});

853+700854

it("uses requester session channel policy for host-media reads", async () => {

701855

const handlePolicyCheckedAction = vi.fn(async ({ mediaAccess }) =>

702856

jsonResult({