-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopup.js
More file actions
40 lines (32 loc) · 1.15 KB
/
popup.js
File metadata and controls
40 lines (32 loc) · 1.15 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
function defineTool(name, automationScope, automationMethod) {
return {
[name]: args => {
console.debug(`[${name}]`, args);
return browser.tabs
.sendMessage(0, {
automationScope,
automationMethod,
args
});
}
};
}
const CLIENT_TOOLS = {
...defineTool("take_dom_snapshot", "see", "domSnapshot"),
...defineTool("mouse_move", "act", "mouseMove"),
...defineTool("scroll", "act", "scroll"),
...defineTool("click", "act", "click"),
...defineTool("type", "act", "type"),
...defineTool("text_select", "act", "textSelect"),
...defineTool("navigate", null, "navigate"),
...defineTool("get_current_location", "custom", "getCurrentLocation"),
};
function init() {
const el = document.createElement("elevenlabs-convai");
el.setAttribute("agent-id", browser.webfuseSession.env.AGENT_KEY);
document.body.appendChild(el);
el.addEventListener("elevenlabs-convai:call", (event) => {
event.detail.config.clientTools = CLIENT_TOOLS;
});
}
document.addEventListener("DOMContentLoaded", init);