-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdebug-verify-draft.ts
More file actions
52 lines (42 loc) · 1.34 KB
/
debug-verify-draft.ts
File metadata and controls
52 lines (42 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { connectToSuperhuman, disconnect } from "./src/superhuman-api";
async function verifyDraft() {
console.log("=== Verifying Draft State After CLI ===\n");
const conn = await connectToSuperhuman(9333, true);
if (!conn) {
console.error("Failed to connect");
return;
}
// Check what's in the compose form controller
const result = await conn.Runtime.evaluate({
expression: `
(() => {
const cfc = window.ViewState?._composeFormController;
if (!cfc) return { error: "No cfc" };
const keys = Object.keys(cfc).filter(k => k.startsWith('draft'));
const drafts = keys.map(key => {
const ctrl = cfc[key];
const draft = ctrl?.state?.draft;
return {
key,
draftId: draft?.id,
subject: draft?.subject,
to: (draft?.to || []).map(r => r.email),
cc: (draft?.cc || []).map(r => r.email),
body: draft?.body,
from: draft?.from?.email,
dirty: draft?.dirty
};
});
return {
totalDrafts: keys.length,
drafts
};
})()
`,
returnByValue: true
});
console.log("Current draft state in Superhuman:");
console.log(JSON.stringify(result.result.value, null, 2));
await disconnect(conn);
}
verifyDraft().catch(console.error);