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

推荐订阅源

J
Java Code Geeks
Martin Fowler
Martin Fowler
B
Blog RSS Feed
D
DataBreaches.Net
L
LangChain Blog
月光博客
月光博客
S
SegmentFault 最新的问题
阮一峰的网络日志
阮一峰的网络日志
V
Visual Studio Blog
美团技术团队
Jina AI
Jina AI
博客园 - 司徒正美
雷峰网
雷峰网
Last Week in AI
Last Week in AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
IT之家
IT之家
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
小众软件
小众软件
罗磊的独立博客
博客园_首页
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
A
About on SuperTechFans
Engineering at Meta
Engineering at Meta

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: await xai realtime events directly · openclaw/openc...
shakkernerd · 2026-05-09 · via Recent Commits to openclaw:main

@@ -21,6 +21,10 @@ async function createRealtimeSttServer(params?: {

2121

const wss = new WebSocketServer({ noServer: true });

2222

const clients = new Set<WebSocket>();

2323

const done = vi.fn();

24+

let resolveDone: (() => void) | undefined;

25+

const donePromise = new Promise<void>((resolve) => {

26+

resolveDone = resolve;

27+

});

24282529

server.on("upgrade", (request, socket, head) => {

2630

const url = new URL(request.url ?? "/", "http://127.0.0.1");

@@ -59,6 +63,7 @@ async function createRealtimeSttServer(params?: {

5963

if (event.type === "audio.done") {

6064

ws.send(JSON.stringify({ type: "transcript.done", text: "hello openclaw final" }));

6165

done();

66+

resolveDone?.();

6267

}

6368

});

6469

});

@@ -73,22 +78,7 @@ async function createRealtimeSttServer(params?: {

7378

await new Promise<void>((resolve) => wss.close(() => resolve()));

7479

await new Promise<void>((resolve) => server.close(() => resolve()));

7580

};

76-

return { baseUrl: `http://127.0.0.1:${port}/v1`, done };

77-

}

78-79-

async function waitFor(expectation: () => void) {

80-

const started = Date.now();

81-

let lastError: unknown;

82-

while (Date.now() - started < 3000) {

83-

try {

84-

expectation();

85-

return;

86-

} catch (error) {

87-

lastError = error;

88-

await new Promise((resolve) => setTimeout(resolve, 25));

89-

}

90-

}

91-

throw lastError;

81+

return { baseUrl: `http://127.0.0.1:${port}/v1`, done, donePromise };

9282

}

93839484

describe("xai realtime transcription provider", () => {

@@ -132,7 +122,15 @@ describe("xai realtime transcription provider", () => {

132122

});

133123

const provider = buildXaiRealtimeTranscriptionProvider();

134124

const onPartial = vi.fn();

135-

const onTranscript = vi.fn();

125+

let resolveFinalTranscript: (() => void) | undefined;

126+

const finalTranscript = new Promise<void>((resolve) => {

127+

resolveFinalTranscript = resolve;

128+

});

129+

const onTranscript = vi.fn((text: string) => {

130+

if (text === "hello openclaw final") {

131+

resolveFinalTranscript?.();

132+

}

133+

});

136134

const onSpeechStart = vi.fn();

137135138136

const session = provider.createSession({

@@ -151,9 +149,9 @@ describe("xai realtime transcription provider", () => {

151149

session.sendAudio(Buffer.from("queued-before-ready"));

152150

await session.connect();

153151

session.sendAudio(Buffer.from("after-ready"));

154-

await waitFor(() => expect(onTranscript).toHaveBeenCalledWith("hello openclaw final"));

152+

await finalTranscript;

155153

session.close();

156-

await waitFor(() => expect(server.done).toHaveBeenCalled());

154+

await server.donePromise;

157155158156

expect(requestUrls[0]?.pathname).toBe("/v1/stt");

159157

expect(requestUrls[0]?.searchParams.get("sample_rate")).toBe("24000");