test: simplify pi runner session jsonl parsing · openclaw/openclaw@fc74dc5
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -248,10 +248,13 @@ const textFromContent = (content: unknown) => {
|
248 | 248 | |
249 | 249 | const readSessionEntries = async (sessionFile: string) => { |
250 | 250 | const raw = await fs.readFile(sessionFile, "utf-8"); |
251 | | -return raw |
252 | | -.split(/\r?\n/) |
253 | | -.filter(Boolean) |
254 | | -.map((line) => JSON.parse(line) as { type?: string; customType?: string; data?: unknown }); |
| 251 | +const entries: Array<{ type?: string; customType?: string; data?: unknown }> = []; |
| 252 | +for (const line of raw.split(/\r?\n/)) { |
| 253 | +if (line.length > 0) { |
| 254 | +entries.push(JSON.parse(line) as { type?: string; customType?: string; data?: unknown }); |
| 255 | +} |
| 256 | +} |
| 257 | +return entries; |
255 | 258 | }; |
256 | 259 | |
257 | 260 | const readSessionMessages = async (sessionFile: string) => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。