-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcompose-debug.ts
More file actions
38 lines (32 loc) · 1.03 KB
/
compose-debug.ts
File metadata and controls
38 lines (32 loc) · 1.03 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
import { connectToSuperhuman, disconnect } from "./src/superhuman-api";
async function debugCompose() {
const conn = await connectToSuperhuman(9333, true);
if (!conn) return;
const result = await conn.Runtime.evaluate({
expression: `
(async () => {
try {
const rc = window.ViewState?.regionalCommands;
const commands = [];
for (const region of rc) {
if (region?.commands) {
for (const cmd of region.commands) {
commands.push({ id: cmd.id, name: cmd.name });
}
}
}
// Search for COMPOSE
const composeCmd = commands.find(c => c.id === 'COMPOSE' || c.id === 'NEW_MESSAGE');
return { composeCmd, commands: commands.map(c => c.id) };
} catch (e) {
return { error: e.message };
}
})()
`,
returnByValue: true,
awaitPromise: true
});
console.log(JSON.stringify(result.result.value, null, 2));
await disconnect(conn);
}
debugCompose();