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

推荐订阅源

D
DataBreaches.Net
GbyAI
GbyAI
aimingoo的专栏
aimingoo的专栏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
月光博客
月光博客
大猫的无限游戏
大猫的无限游戏
M
MIT News - Artificial intelligence
腾讯CDC
博客园 - Franky
Engineering at Meta
Engineering at Meta
C
Check Point Blog
T
The Blog of Author Tim Ferriss
有赞技术团队
有赞技术团队
Microsoft Azure Blog
Microsoft Azure Blog
MyScale Blog
MyScale Blog
I
InfoQ
Blog — PlanetScale
Blog — PlanetScale
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
N
Netflix TechBlog - Medium
Last Week in AI
Last Week in AI
S
SegmentFault 最新的问题
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
WordPress大学
WordPress大学

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(repro): clean webchat tts proof artifacts · openclaw/...
vincentkoc · 2026-06-02 · via Recent Commits to openclaw:main

@@ -6,6 +6,7 @@

66

import fs from "node:fs";

77

import os from "node:os";

88

import path from "node:path";

9+

import { pathToFileURL } from "node:url";

910

import { maybeApplyTtsToPayload } from "../../packages/speech-core/src/tts.ts";

1011

import { buildWebchatAudioContentBlocksFromReplyPayloads } from "../../src/gateway/server-methods/chat-webchat-media.ts";

1112

import { createPluginRecord } from "../../src/plugins/loader-records.ts";

@@ -22,8 +23,16 @@ const noopLogger = {

2223

debug() {},

2324

};

242526+

export function cleanupProofArtifacts({ mediaPath, prefsPath }) {

27+

if (mediaPath) {

28+

fs.rmSync(path.dirname(mediaPath), { recursive: true, force: true });

29+

}

30+

fs.rmSync(prefsPath, { force: true });

31+

}

32+2533

async function main() {

2634

resetPluginRuntimeStateForTest();

35+

let mediaPath;

2736

const pluginRegistry = createPluginRegistry({

2837

logger: noopLogger,

2938

runtime: {},

@@ -62,65 +71,65 @@ async function main() {

6271

},

6372

};

647365-

const accumulatedBlockText =

66-

"WebChat streams block text; dispatch synthesizes one TTS tail with kind final.";

67-

const blockResult = await maybeApplyTtsToPayload({

68-

payload: { text: accumulatedBlockText },

69-

cfg,

70-

channel: "webchat",

71-

kind: "block",

72-

});

73-

console.log("maybeApplyTtsToPayload(kind=block).mediaUrl =", blockResult.mediaUrl ?? "(none)");

74-75-

const tailResult = await maybeApplyTtsToPayload({

76-

payload: { text: accumulatedBlockText },

77-

cfg,

78-

channel: "webchat",

79-

kind: "final",

80-

});

81-

console.log("maybeApplyTtsToPayload(kind=final).mediaUrl =", tailResult.mediaUrl ?? "(none)");

82-

console.log(

83-

"maybeApplyTtsToPayload(kind=final).trustedLocalMedia =",

84-

tailResult.trustedLocalMedia ?? false,

85-

);

74+

try {

75+

const accumulatedBlockText =

76+

"WebChat streams block text; dispatch synthesizes one TTS tail with kind final.";

77+

const blockResult = await maybeApplyTtsToPayload({

78+

payload: { text: accumulatedBlockText },

79+

cfg,

80+

channel: "webchat",

81+

kind: "block",

82+

});

83+

console.log("maybeApplyTtsToPayload(kind=block).mediaUrl =", blockResult.mediaUrl ?? "(none)");

868487-

const mediaPath = tailResult.mediaUrl;

88-

if (!mediaPath || !fs.existsSync(mediaPath)) {

89-

throw new Error("expected final-mode tail TTS to write a local media file");

90-

}

85+

const tailResult = await maybeApplyTtsToPayload({

86+

payload: { text: accumulatedBlockText },

87+

cfg,

88+

channel: "webchat",

89+

kind: "final",

90+

});

91+

console.log("maybeApplyTtsToPayload(kind=final).mediaUrl =", tailResult.mediaUrl ?? "(none)");

92+

console.log(

93+

"maybeApplyTtsToPayload(kind=final).trustedLocalMedia =",

94+

tailResult.trustedLocalMedia ?? false,

95+

);

919692-

// Same shape as dispatch-from-config accumulated block TTS-only final payload.

93-

const ttsOnlyPayload = {

94-

mediaUrl: tailResult.mediaUrl,

95-

audioAsVoice: tailResult.audioAsVoice,

96-

spokenText: accumulatedBlockText,

97-

trustedLocalMedia: true,

98-

};

99-

console.log("dispatch ttsOnlyPayload.trustedLocalMedia =", ttsOnlyPayload.trustedLocalMedia);

97+

mediaPath = tailResult.mediaUrl;

98+

if (!mediaPath || !fs.existsSync(mediaPath)) {

99+

throw new Error("expected final-mode tail TTS to write a local media file");

100+

}

100101101-

const localRoots = [path.dirname(mediaPath)];

102-

const trustedBlocks = await buildWebchatAudioContentBlocksFromReplyPayloads([ttsOnlyPayload], {

103-

localRoots,

104-

});

105-

const untrustedBlocks = await buildWebchatAudioContentBlocksFromReplyPayloads(

106-

[{ mediaUrl: mediaPath }],

107-

{ localRoots },

108-

);

109-

console.log(

110-

"buildWebchatAudioContentBlocksFromReplyPayloads(ttsOnlyPayload).length =",

111-

trustedBlocks.length,

112-

);

113-

console.log(

114-

"buildWebchatAudioContentBlocksFromReplyPayloads(untrusted).length =",

115-

untrustedBlocks.length,

116-

);

102+

// Same shape as dispatch-from-config accumulated block TTS-only final payload.

103+

const ttsOnlyPayload = {

104+

mediaUrl: tailResult.mediaUrl,

105+

audioAsVoice: tailResult.audioAsVoice,

106+

spokenText: accumulatedBlockText,

107+

trustedLocalMedia: true,

108+

};

109+

console.log("dispatch ttsOnlyPayload.trustedLocalMedia =", ttsOnlyPayload.trustedLocalMedia);

117110118-

fs.rmSync(path.dirname(mediaPath), { recursive: true, force: true });

119-

try {

120-

fs.unlinkSync(prefsPath);

121-

} catch {

122-

// optional prefs file

111+

const localRoots = [path.dirname(mediaPath)];

112+

const trustedBlocks = await buildWebchatAudioContentBlocksFromReplyPayloads([ttsOnlyPayload], {

113+

localRoots,

114+

});

115+

const untrustedBlocks = await buildWebchatAudioContentBlocksFromReplyPayloads(

116+

[{ mediaUrl: mediaPath }],

117+

{ localRoots },

118+

);

119+

console.log(

120+

"buildWebchatAudioContentBlocksFromReplyPayloads(ttsOnlyPayload).length =",

121+

trustedBlocks.length,

122+

);

123+

console.log(

124+

"buildWebchatAudioContentBlocksFromReplyPayloads(untrusted).length =",

125+

untrustedBlocks.length,

126+

);

127+

} finally {

128+

cleanupProofArtifacts({ mediaPath, prefsPath });

129+

resetPluginRuntimeStateForTest();

123130

}

124131

}

125132126-

await main();

133+

if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {

134+

await main();

135+

}