test(release): accept trajectory command session final · openclaw/openclaw@c60b424
vincentkoc
·
2026-06-14
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -207,6 +207,12 @@ async function waitForTrajectoryExportInstructionText(params: {
|
207 | 207 | if (eventText) { |
208 | 208 | return eventText; |
209 | 209 | } |
| 210 | +const sessionEventText = params.events |
| 211 | +.map((event) => extractChatFinalTextForSession(event, params.sessionKey)) |
| 212 | +.find((text) => text?.includes(params.expectedText)); |
| 213 | +if (sessionEventText) { |
| 214 | +return sessionEventText; |
| 215 | +} |
210 | 216 | const history: { messages?: unknown[] } = await params.client.request( |
211 | 217 | "chat.history", |
212 | 218 | { |
@@ -242,6 +248,25 @@ function extractChatFinalText(event: EventFrame, runId: string): string | undefi
|
242 | 248 | if (record.runId !== runId || record.state !== "final") { |
243 | 249 | return undefined; |
244 | 250 | } |
| 251 | +return extractChatFinalRecordText(record); |
| 252 | +} |
| 253 | + |
| 254 | +function extractChatFinalTextForSession(event: EventFrame, sessionKey: string): string | undefined { |
| 255 | +if (event.event !== "chat") { |
| 256 | +return undefined; |
| 257 | +} |
| 258 | +const payload = event.payload; |
| 259 | +if (!payload || typeof payload !== "object") { |
| 260 | +return undefined; |
| 261 | +} |
| 262 | +const record = payload as Record<string, unknown>; |
| 263 | +if (record.sessionKey !== sessionKey || record.state !== "final") { |
| 264 | +return undefined; |
| 265 | +} |
| 266 | +return extractChatFinalRecordText(record); |
| 267 | +} |
| 268 | + |
| 269 | +function extractChatFinalRecordText(record: Record<string, unknown>): string | undefined { |
245 | 270 | const message = record.message; |
246 | 271 | if (!message || typeof message !== "object") { |
247 | 272 | return undefined; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。