-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecover.ts
More file actions
23 lines (21 loc) · 918 Bytes
/
recover.ts
File metadata and controls
23 lines (21 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { readFileSync, writeFileSync } from "fs";
const logData = readFileSync("/Users/henryoman/.cursor/projects/Volumes-T9-cursor-mog/terminals/293241.txt", "utf8");
const lines = logData.split("\n");
const recovered = [];
for (const line of lines) {
if (line.includes("result") && line.includes("screenName")) {
try {
const match = line.match(/result\x1b\[39m: "(.*)"/);
if (match && match[1]) {
// Unescape the string
let unescaped = match[1].replace(/\\"/g, '"').replace(/\\\\/g, '\\');
// Handle potential truncation... the log might be truncated if it's too long?
if (unescaped.endsWith("...\"") || unescaped.endsWith("...")) {
// Actually, the log shows `\"result\": \"{\\\"screenName\\\":...`
// Let's see if it's truncated.
// In Stagehand logs, long strings are often truncated.
}
}
} catch (e) {}
}
}