@eko-ai/eko 1.0.1-5.alpha-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +139 -0
- package/dist/core/eko.d.ts +22 -0
- package/dist/core/tool-registry.d.ts +13 -0
- package/dist/extension/content/index.d.ts +16 -0
- package/dist/extension/core.d.ts +11 -0
- package/dist/extension/index.d.ts +7 -0
- package/dist/extension/script/bing.js +25 -0
- package/dist/extension/script/build_dom_tree.d.ts +38 -0
- package/dist/extension/script/build_dom_tree.js +662 -0
- package/dist/extension/script/common.js +212 -0
- package/dist/extension/script/duckduckgo.js +25 -0
- package/dist/extension/script/google.js +26 -0
- package/dist/extension/tools/browser.d.ts +22 -0
- package/dist/extension/tools/browser_use.d.ts +19 -0
- package/dist/extension/tools/element_click.d.ts +12 -0
- package/dist/extension/tools/export_file.d.ts +18 -0
- package/dist/extension/tools/extract_content.d.ts +18 -0
- package/dist/extension/tools/find_element_position.d.ts +12 -0
- package/dist/extension/tools/get_all_tabs.d.ts +9 -0
- package/dist/extension/tools/html_script.d.ts +10 -0
- package/dist/extension/tools/index.d.ts +13 -0
- package/dist/extension/tools/open_url.d.ts +18 -0
- package/dist/extension/tools/request_login.d.ts +10 -0
- package/dist/extension/tools/screenshot.d.ts +18 -0
- package/dist/extension/tools/tab_management.d.ts +19 -0
- package/dist/extension/tools/web_search.d.ts +18 -0
- package/dist/extension/utils.d.ts +31 -0
- package/dist/extension.cjs.js +2322 -0
- package/dist/extension.esm.js +2315 -0
- package/dist/extension_content_script.js +424 -0
- package/dist/fellou/computer.d.ts +20 -0
- package/dist/fellou/index.d.ts +6 -0
- package/dist/fellou/tools/computer_use.d.ts +18 -0
- package/dist/fellou.cjs.js +238 -0
- package/dist/fellou.esm.js +235 -0
- package/dist/index.cjs.js +9943 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.esm.js +9932 -0
- package/dist/models/action.d.ts +26 -0
- package/dist/models/workflow.d.ts +23 -0
- package/dist/nodejs/core.d.ts +2 -0
- package/dist/nodejs/index.d.ts +3 -0
- package/dist/nodejs/script/build_dom_tree.d.ts +1 -0
- package/dist/nodejs/tools/browser_use.d.ts +28 -0
- package/dist/nodejs/tools/command_execute.d.ts +12 -0
- package/dist/nodejs/tools/file_read.d.ts +11 -0
- package/dist/nodejs/tools/file_write.d.ts +15 -0
- package/dist/nodejs/tools/index.d.ts +5 -0
- package/dist/nodejs.cjs.js +71908 -0
- package/dist/nodejs.esm.js +71905 -0
- package/dist/schemas/workflow.schema.d.ts +77 -0
- package/dist/services/llm/claude-provider.d.ts +12 -0
- package/dist/services/llm/openai-provider.d.ts +12 -0
- package/dist/services/parser/workflow-parser.d.ts +23 -0
- package/dist/services/workflow/generator.d.ts +14 -0
- package/dist/services/workflow/templates.d.ts +8 -0
- package/dist/types/action.types.d.ts +45 -0
- package/dist/types/eko.types.d.ts +24 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/llm.types.d.ts +52 -0
- package/dist/types/parser.types.d.ts +9 -0
- package/dist/types/tools.types.d.ts +131 -0
- package/dist/types/workflow.types.d.ts +54 -0
- package/dist/universal_tools/cancel_workflow.d.ts +9 -0
- package/dist/universal_tools/human.d.ts +30 -0
- package/dist/universal_tools/index.d.ts +4 -0
- package/dist/universal_tools/summary_workflow.d.ts +9 -0
- package/dist/utils/execution-logger.d.ts +69 -0
- package/dist/web/core.d.ts +2 -0
- package/dist/web/index.d.ts +5 -0
- package/dist/web/script/build_dom_tree.d.ts +10 -0
- package/dist/web/tools/browser.d.ts +21 -0
- package/dist/web/tools/browser_use.d.ts +19 -0
- package/dist/web/tools/element_click.d.ts +12 -0
- package/dist/web/tools/export_file.d.ts +18 -0
- package/dist/web/tools/extract_content.d.ts +17 -0
- package/dist/web/tools/find_element_position.d.ts +12 -0
- package/dist/web/tools/html_script.d.ts +10 -0
- package/dist/web/tools/index.d.ts +8 -0
- package/dist/web/tools/screenshot.d.ts +18 -0
- package/dist/web.cjs.js +9651 -0
- package/dist/web.esm.js +9647 -0
- package/package.json +106 -0
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
if (!window.eko) {
|
|
2
|
+
window.eko = { lastMouseX: 0, lastMouseY: 0 };
|
|
3
|
+
}
|
|
4
|
+
eko.sub = function (event, callback) {
|
|
5
|
+
if (!eko.subListeners) {
|
|
6
|
+
eko.subListeners = {};
|
|
7
|
+
}
|
|
8
|
+
if (event && callback) {
|
|
9
|
+
eko.subListeners[event] = callback;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
document.addEventListener('mousemove', (event) => {
|
|
13
|
+
eko.lastMouseX = event.clientX;
|
|
14
|
+
eko.lastMouseY = event.clientY;
|
|
15
|
+
});
|
|
16
|
+
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
|
|
17
|
+
(async () => {
|
|
18
|
+
try {
|
|
19
|
+
switch (request.type) {
|
|
20
|
+
case 'eko:message': {
|
|
21
|
+
let result = null;
|
|
22
|
+
if (eko.subListeners && eko.subListeners[request.event]) {
|
|
23
|
+
try {
|
|
24
|
+
result = await eko.subListeners[request.event](request.params);
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
console.log(e);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
sendResponse(result);
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
case 'page:getDetailLinks': {
|
|
34
|
+
let result = await eko.getDetailLinks(request.search);
|
|
35
|
+
sendResponse(result);
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
case 'page:getContent': {
|
|
39
|
+
let result = await eko.getContent(request.search);
|
|
40
|
+
sendResponse(result);
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
case 'request_user_help': {
|
|
44
|
+
request_user_help(request.task_id, request.failure_type, request.failure_message);
|
|
45
|
+
sendResponse(true);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
case 'computer:type': {
|
|
49
|
+
sendResponse(type(request));
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
case 'computer:mouse_move': {
|
|
53
|
+
sendResponse(mouse_move(request));
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
case 'computer:left_click': {
|
|
57
|
+
sendResponse(simulateMouseEvent(request, ['mousedown', 'mouseup', 'click'], 0));
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
case 'computer:right_click': {
|
|
61
|
+
sendResponse(simulateMouseEvent(request, ['mousedown', 'mouseup', 'contextmenu'], 2));
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
case 'computer:double_click': {
|
|
65
|
+
sendResponse(simulateMouseEvent(request, ['mousedown', 'mouseup', 'click', 'mousedown', 'mouseup', 'click', 'dblclick'], 0));
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
case 'computer:scroll_to': {
|
|
69
|
+
sendResponse(scroll_to(request));
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
case 'computer:cursor_position': {
|
|
73
|
+
sendResponse({ coordinate: [eko.lastMouseX, eko.lastMouseY] });
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
case 'computer:get_dropdown_options': {
|
|
77
|
+
sendResponse(get_dropdown_options(request));
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
case 'computer:select_dropdown_option': {
|
|
81
|
+
sendResponse(select_dropdown_option(request));
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch (e) {
|
|
87
|
+
console.log('onMessage error', e);
|
|
88
|
+
sendResponse(false);
|
|
89
|
+
}
|
|
90
|
+
})();
|
|
91
|
+
return true;
|
|
92
|
+
});
|
|
93
|
+
function type(request) {
|
|
94
|
+
let text = request.text;
|
|
95
|
+
let enter = false;
|
|
96
|
+
if (text.endsWith('\\n')) {
|
|
97
|
+
enter = true;
|
|
98
|
+
text = text.substring(0, text.length - 2);
|
|
99
|
+
}
|
|
100
|
+
else if (text.endsWith('\n')) {
|
|
101
|
+
enter = true;
|
|
102
|
+
text = text.substring(0, text.length - 1);
|
|
103
|
+
}
|
|
104
|
+
let element;
|
|
105
|
+
if (request.highlightIndex != null) {
|
|
106
|
+
element = window.get_highlight_element(request.highlightIndex);
|
|
107
|
+
}
|
|
108
|
+
else if (request.xpath) {
|
|
109
|
+
let xpath = request.xpath;
|
|
110
|
+
let result = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
|
|
111
|
+
element = result.singleNodeValue;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
let coordinate = request.coordinate;
|
|
115
|
+
element = document.elementFromPoint(coordinate[0], coordinate[1]) || document.activeElement;
|
|
116
|
+
}
|
|
117
|
+
if (!element) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
let input;
|
|
121
|
+
if (element.tagName == 'IFRAME') {
|
|
122
|
+
let iframeDoc = element.contentDocument || element.contentWindow.document;
|
|
123
|
+
input =
|
|
124
|
+
iframeDoc.querySelector('textarea') ||
|
|
125
|
+
iframeDoc.querySelector('*[contenteditable="true"]') ||
|
|
126
|
+
iframeDoc.querySelector('input');
|
|
127
|
+
}
|
|
128
|
+
else if (element.tagName == 'INPUT' ||
|
|
129
|
+
element.tagName == 'TEXTAREA' ||
|
|
130
|
+
element.childElementCount == 0) {
|
|
131
|
+
input = element;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
input =
|
|
135
|
+
element.querySelector('input') ||
|
|
136
|
+
element.querySelector('textarea') ||
|
|
137
|
+
element.querySelector('*[contenteditable="true"]') ||
|
|
138
|
+
element;
|
|
139
|
+
}
|
|
140
|
+
input.focus && input.focus();
|
|
141
|
+
if (!text) {
|
|
142
|
+
if (input.value == undefined) {
|
|
143
|
+
input.textContent = '';
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
input.value = '';
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
if (input.value == undefined) {
|
|
151
|
+
input.textContent += text;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
input.value += text;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
let result = input.dispatchEvent(new Event('input', { bubbles: true }));
|
|
158
|
+
if (enter) {
|
|
159
|
+
['keydown', 'keypress', 'keyup'].forEach((eventType) => {
|
|
160
|
+
const event = new KeyboardEvent(eventType, {
|
|
161
|
+
key: 'Enter',
|
|
162
|
+
code: 'Enter',
|
|
163
|
+
keyCode: 13,
|
|
164
|
+
bubbles: true,
|
|
165
|
+
cancelable: true,
|
|
166
|
+
});
|
|
167
|
+
input.dispatchEvent(event);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
console.log('type', input, request, result);
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
function mouse_move(request) {
|
|
174
|
+
let coordinate = request.coordinate;
|
|
175
|
+
let x = coordinate[0];
|
|
176
|
+
let y = coordinate[1];
|
|
177
|
+
const event = new MouseEvent('mousemove', {
|
|
178
|
+
view: window,
|
|
179
|
+
bubbles: true,
|
|
180
|
+
cancelable: true,
|
|
181
|
+
screenX: x,
|
|
182
|
+
screenY: y,
|
|
183
|
+
clientX: x,
|
|
184
|
+
clientY: y,
|
|
185
|
+
});
|
|
186
|
+
let result = document.body.dispatchEvent(event);
|
|
187
|
+
console.log('mouse_move', document.body, request, result);
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
function simulateMouseEvent(request, eventTypes, button) {
|
|
191
|
+
let element;
|
|
192
|
+
if (request.highlightIndex != null) {
|
|
193
|
+
element = window.get_highlight_element(request.highlightIndex);
|
|
194
|
+
}
|
|
195
|
+
else if (request.xpath) {
|
|
196
|
+
let xpath = request.xpath;
|
|
197
|
+
let result = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
|
|
198
|
+
element = result.singleNodeValue;
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
let coordinate = request.coordinate;
|
|
202
|
+
element = document.elementFromPoint(coordinate[0], coordinate[1]) || document.body;
|
|
203
|
+
}
|
|
204
|
+
if (!element) {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
const x = undefined;
|
|
208
|
+
const y = undefined;
|
|
209
|
+
for (let i = 0; i < eventTypes.length; i++) {
|
|
210
|
+
const event = new MouseEvent(eventTypes[i], {
|
|
211
|
+
view: window,
|
|
212
|
+
bubbles: true,
|
|
213
|
+
cancelable: true,
|
|
214
|
+
clientX: x,
|
|
215
|
+
clientY: y,
|
|
216
|
+
button, // 0 left; 2 right
|
|
217
|
+
});
|
|
218
|
+
let result = element.dispatchEvent(event);
|
|
219
|
+
console.log('simulateMouse', element, { ...request, eventTypes, button }, result);
|
|
220
|
+
}
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
function scroll_to(request) {
|
|
224
|
+
if (request.highlightIndex != null) {
|
|
225
|
+
let element = window.get_highlight_element(request.highlightIndex);
|
|
226
|
+
if (!element) {
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
element.scrollIntoView({
|
|
230
|
+
behavior: 'smooth',
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
else if (request.xpath) {
|
|
234
|
+
let xpath = request.xpath;
|
|
235
|
+
let result = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
|
|
236
|
+
let element = result.singleNodeValue;
|
|
237
|
+
if (!element) {
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
element.scrollIntoView({
|
|
241
|
+
behavior: 'smooth',
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
const to_coordinate = request.to_coordinate;
|
|
246
|
+
window.scrollTo({
|
|
247
|
+
left: to_coordinate[0],
|
|
248
|
+
top: to_coordinate[1],
|
|
249
|
+
behavior: 'smooth',
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
console.log('scroll_to', request);
|
|
253
|
+
return true;
|
|
254
|
+
}
|
|
255
|
+
function get_dropdown_options(request) {
|
|
256
|
+
let select;
|
|
257
|
+
if (request.highlightIndex != null) {
|
|
258
|
+
select = window.get_highlight_element(request.highlightIndex);
|
|
259
|
+
}
|
|
260
|
+
else if (request.xpath) {
|
|
261
|
+
select = document.evaluate(request.xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
|
262
|
+
}
|
|
263
|
+
if (!select) {
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
return {
|
|
267
|
+
options: Array.from(select.options).map((opt) => ({
|
|
268
|
+
index: opt.index,
|
|
269
|
+
text: opt.text.trim(),
|
|
270
|
+
value: opt.value,
|
|
271
|
+
})),
|
|
272
|
+
id: select.id,
|
|
273
|
+
name: select.name,
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function select_dropdown_option(request) {
|
|
277
|
+
let select;
|
|
278
|
+
if (request.highlightIndex != null) {
|
|
279
|
+
select = window.get_highlight_element(request.highlightIndex);
|
|
280
|
+
}
|
|
281
|
+
else if (request.xpath) {
|
|
282
|
+
select = document.evaluate(request.xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
|
283
|
+
}
|
|
284
|
+
if (!select || select.tagName.toUpperCase() !== 'SELECT') {
|
|
285
|
+
return { success: false, error: 'Select not found or invalid element type' };
|
|
286
|
+
}
|
|
287
|
+
const option = Array.from(select.options).find((opt) => opt.text.trim() === request.text);
|
|
288
|
+
if (!option) {
|
|
289
|
+
return {
|
|
290
|
+
success: false,
|
|
291
|
+
error: 'Option not found',
|
|
292
|
+
availableOptions: Array.from(select.options).map((o) => o.text.trim()),
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
select.value = option.value;
|
|
296
|
+
select.dispatchEvent(new Event('change'));
|
|
297
|
+
return {
|
|
298
|
+
success: true,
|
|
299
|
+
selectedValue: option.value,
|
|
300
|
+
selectedText: option.text.trim(),
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
function request_user_help(task_id, failure_type, failure_message) {
|
|
304
|
+
const domId = 'eko-request-user-help';
|
|
305
|
+
if (document.getElementById(domId)) {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
const failureTitleMap = {
|
|
309
|
+
login_required: 'Login Required',
|
|
310
|
+
captcha: 'Captcha Detected',
|
|
311
|
+
blocked: 'Blocked',
|
|
312
|
+
other: 'Error',
|
|
313
|
+
rate_limited: 'Rate Limited',
|
|
314
|
+
};
|
|
315
|
+
const notification = document.createElement('div');
|
|
316
|
+
notification.id = domId;
|
|
317
|
+
notification.style.cssText = `
|
|
318
|
+
position: fixed;
|
|
319
|
+
top: 5px;
|
|
320
|
+
left: 18px;
|
|
321
|
+
z-index: 999999;
|
|
322
|
+
background-color: #FEF0ED;
|
|
323
|
+
color: white;
|
|
324
|
+
padding: 16px;
|
|
325
|
+
border-radius: 12px;
|
|
326
|
+
border: 1px solid #FBB8A5;
|
|
327
|
+
font-family: Arial, sans-serif;
|
|
328
|
+
width: 350px;
|
|
329
|
+
display: flex;
|
|
330
|
+
flex-direction: row;
|
|
331
|
+
gap: 10px;
|
|
332
|
+
cursor: move;
|
|
333
|
+
user-select: none;
|
|
334
|
+
`;
|
|
335
|
+
let isDragging = false;
|
|
336
|
+
let xOffset = 0;
|
|
337
|
+
let yOffset = 0;
|
|
338
|
+
let initialX = 0;
|
|
339
|
+
let initialY = 0;
|
|
340
|
+
notification.addEventListener('mousedown', (e) => {
|
|
341
|
+
isDragging = true;
|
|
342
|
+
initialX = e.clientX - xOffset;
|
|
343
|
+
initialY = e.clientY - yOffset;
|
|
344
|
+
e.preventDefault();
|
|
345
|
+
});
|
|
346
|
+
document.addEventListener('mousemove', (e) => {
|
|
347
|
+
if (!isDragging)
|
|
348
|
+
return;
|
|
349
|
+
const currentX = e.clientX - initialX;
|
|
350
|
+
const currentY = e.clientY - initialY;
|
|
351
|
+
xOffset = currentX;
|
|
352
|
+
yOffset = currentY;
|
|
353
|
+
notification.style.transform = `translate(${xOffset}px, ${yOffset}px)`;
|
|
354
|
+
});
|
|
355
|
+
document.addEventListener('mouseup', () => {
|
|
356
|
+
isDragging = false;
|
|
357
|
+
});
|
|
358
|
+
const leftContainer = document.createElement('div');
|
|
359
|
+
leftContainer.style.cssText = `
|
|
360
|
+
width: 28px;
|
|
361
|
+
height: 28px;
|
|
362
|
+
display: flex;
|
|
363
|
+
flex-direction: column;
|
|
364
|
+
align-items: center;
|
|
365
|
+
border-radius: 99px;
|
|
366
|
+
background: #FDCCCC;
|
|
367
|
+
justify-content: center;
|
|
368
|
+
`;
|
|
369
|
+
leftContainer.innerHTML = ``;
|
|
370
|
+
const rightContainer = document.createElement('div');
|
|
371
|
+
rightContainer.style.cssText = `
|
|
372
|
+
flex: 1;
|
|
373
|
+
display: flex;
|
|
374
|
+
flex-direction: column;
|
|
375
|
+
`;
|
|
376
|
+
const title = document.createElement('div');
|
|
377
|
+
title.style.cssText = `
|
|
378
|
+
font-size: 16px;
|
|
379
|
+
font-weight: 700;
|
|
380
|
+
line-height: 22px;
|
|
381
|
+
color: #DD342D;
|
|
382
|
+
text-align: left;
|
|
383
|
+
`;
|
|
384
|
+
title.innerText = failureTitleMap[failure_type] || failure_type;
|
|
385
|
+
const message2 = document.createElement('div');
|
|
386
|
+
message2.style.cssText = `
|
|
387
|
+
font-size: 16px;
|
|
388
|
+
font-weight: 400;
|
|
389
|
+
line-height: 22px;
|
|
390
|
+
color: #DD342D;
|
|
391
|
+
text-align: left;
|
|
392
|
+
`;
|
|
393
|
+
message2.innerText = failure_message + '\nWhen you resolve the issue, click the button below.';
|
|
394
|
+
const buttonDiv = document.createElement('div');
|
|
395
|
+
buttonDiv.style.cssText = `
|
|
396
|
+
margin-top: 16px;
|
|
397
|
+
display: flex;
|
|
398
|
+
flex-direction: row-reverse;
|
|
399
|
+
justify-content: flex-start;
|
|
400
|
+
align-items: center;
|
|
401
|
+
`;
|
|
402
|
+
const resolvedBut = document.createElement('div');
|
|
403
|
+
resolvedBut.innerText = 'Resolved';
|
|
404
|
+
resolvedBut.style.cssText = `
|
|
405
|
+
border-radius: 8px;
|
|
406
|
+
background: #DD342D;
|
|
407
|
+
color: white;
|
|
408
|
+
padding: 10px;
|
|
409
|
+
border: none;
|
|
410
|
+
cursor: pointer;
|
|
411
|
+
`;
|
|
412
|
+
resolvedBut.onclick = () => {
|
|
413
|
+
chrome.runtime.sendMessage({ type: 'issue_resolved', task_id, failure_type }, () => {
|
|
414
|
+
notification.remove();
|
|
415
|
+
});
|
|
416
|
+
};
|
|
417
|
+
buttonDiv.appendChild(resolvedBut);
|
|
418
|
+
rightContainer.appendChild(title);
|
|
419
|
+
rightContainer.appendChild(message2);
|
|
420
|
+
rightContainer.appendChild(buttonDiv);
|
|
421
|
+
notification.appendChild(leftContainer);
|
|
422
|
+
notification.appendChild(rightContainer);
|
|
423
|
+
document.body.appendChild(notification);
|
|
424
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare function can_use_computer(): Promise<boolean>;
|
|
2
|
+
export declare function key(key: string, coordinate?: [number, number]): Promise<boolean>;
|
|
3
|
+
export declare function type(text: string, coordinate?: [number, number]): Promise<boolean>;
|
|
4
|
+
export declare function mouse_move(coordinate: [number, number]): Promise<boolean>;
|
|
5
|
+
export declare function left_click(coordinate?: [number, number]): Promise<boolean>;
|
|
6
|
+
export declare function left_click_drag(coordinate: [number, number]): Promise<boolean>;
|
|
7
|
+
export declare function right_click(coordinate?: [number, number]): Promise<boolean>;
|
|
8
|
+
export declare function double_click(coordinate?: [number, number]): Promise<boolean>;
|
|
9
|
+
export declare function screenshot(windowId?: number): Promise<{
|
|
10
|
+
image: {
|
|
11
|
+
type: 'base64';
|
|
12
|
+
media_type: 'image/png' | 'image/jpeg';
|
|
13
|
+
data: string;
|
|
14
|
+
};
|
|
15
|
+
}>;
|
|
16
|
+
export declare function cursor_position(): Promise<{
|
|
17
|
+
coordinate: [number, number];
|
|
18
|
+
}>;
|
|
19
|
+
export declare function size(): Promise<[number, number]>;
|
|
20
|
+
export declare function scroll(coordinate: [number, number]): Promise<boolean>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComputerUseParam, ComputerUseResult } from '../../types/tools.types';
|
|
2
|
+
import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
|
|
3
|
+
/**
|
|
4
|
+
* Computer Use for fellou
|
|
5
|
+
*/
|
|
6
|
+
export declare class ComputerUse implements Tool<ComputerUseParam, ComputerUseResult> {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
input_schema: InputSchema;
|
|
10
|
+
constructor();
|
|
11
|
+
/**
|
|
12
|
+
* computer
|
|
13
|
+
*
|
|
14
|
+
* @param {*} params { action: 'mouse_move', coordinate: [100, 200] }
|
|
15
|
+
* @returns { success: true, coordinate?: [], image?: { type: 'base64', media_type: 'image/jpeg', data: '/9j...' } }
|
|
16
|
+
*/
|
|
17
|
+
execute(context: ExecutionContext, params: ComputerUseParam): Promise<ComputerUseResult>;
|
|
18
|
+
}
|