mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 02:00:43 +00:00
test: simplify pi runner session jsonl parsing
This commit is contained in:
@@ -248,10 +248,13 @@ const textFromContent = (content: unknown) => {
|
||||
|
||||
const readSessionEntries = async (sessionFile: string) => {
|
||||
const raw = await fs.readFile(sessionFile, "utf-8");
|
||||
return raw
|
||||
.split(/\r?\n/)
|
||||
.filter(Boolean)
|
||||
.map((line) => JSON.parse(line) as { type?: string; customType?: string; data?: unknown });
|
||||
const entries: Array<{ type?: string; customType?: string; data?: unknown }> = [];
|
||||
for (const line of raw.split(/\r?\n/)) {
|
||||
if (line.length > 0) {
|
||||
entries.push(JSON.parse(line) as { type?: string; customType?: string; data?: unknown });
|
||||
}
|
||||
}
|
||||
return entries;
|
||||
};
|
||||
|
||||
const readSessionMessages = async (sessionFile: string) => {
|
||||
|
||||
Reference in New Issue
Block a user