@eko-ai/eko 1.3.5 → 2.0.0
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/README.md +37 -19
- package/dist/agent/a2a.d.ts +7 -0
- package/dist/agent/a2a.d.ts.map +1 -0
- package/dist/agent/base.d.ts +47 -0
- package/dist/agent/base.d.ts.map +1 -0
- package/dist/agent/browser/browser_base.d.ts +30 -0
- package/dist/agent/browser/browser_base.d.ts.map +1 -0
- package/dist/agent/browser/browser_labels.d.ts +21 -0
- package/dist/agent/browser/browser_labels.d.ts.map +1 -0
- package/dist/agent/browser/browser_screen.d.ts +16 -0
- package/dist/agent/browser/browser_screen.d.ts.map +1 -0
- package/dist/agent/browser/build_dom_tree.d.ts +2 -0
- package/dist/agent/browser/build_dom_tree.d.ts.map +1 -0
- package/dist/agent/browser/index.d.ts +6 -0
- package/dist/agent/browser/index.d.ts.map +1 -0
- package/dist/agent/chat.d.ts +7 -0
- package/dist/agent/chat.d.ts.map +1 -0
- package/dist/agent/computer.d.ts +23 -0
- package/dist/agent/computer.d.ts.map +1 -0
- package/dist/agent/file.d.ts +14 -0
- package/dist/agent/file.d.ts.map +1 -0
- package/dist/agent/index.d.ts +9 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/shell.d.ts +14 -0
- package/dist/agent/shell.d.ts.map +1 -0
- package/dist/agent/timer.d.ts +5 -0
- package/dist/agent/timer.d.ts.map +1 -0
- package/dist/common/log.d.ts +43 -2
- package/dist/common/log.d.ts.map +1 -0
- package/dist/common/utils.d.ts +12 -0
- package/dist/common/utils.d.ts.map +1 -0
- package/dist/common/xml.d.ts +7 -0
- package/dist/common/xml.d.ts.map +1 -0
- package/dist/config/index.d.ts +8 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/core/chain.d.ts +45 -0
- package/dist/core/chain.d.ts.map +1 -0
- package/dist/core/context.d.ts +23 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/index.d.ts +18 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/plan.d.ts +11 -0
- package/dist/core/plan.d.ts.map +1 -0
- package/dist/index.cjs.js +18163 -10856
- package/dist/index.d.ts +13 -10
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +18147 -10888
- package/dist/llm/index.d.ts +15 -0
- package/dist/llm/index.d.ts.map +1 -0
- package/dist/mcp/client.d.ts +28 -0
- package/dist/mcp/client.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +28 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/prompt/agent.d.ts +6 -0
- package/dist/prompt/agent.d.ts.map +1 -0
- package/dist/prompt/plan.d.ts +4 -0
- package/dist/prompt/plan.d.ts.map +1 -0
- package/dist/tools/foreach_task.d.ts +12 -0
- package/dist/tools/foreach_task.d.ts.map +1 -0
- package/dist/tools/human_interact.d.ts +12 -0
- package/dist/tools/human_interact.d.ts.map +1 -0
- package/dist/tools/index.d.ts +19 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/task_node_status.d.ts +12 -0
- package/dist/tools/task_node_status.d.ts.map +1 -0
- package/dist/tools/variable_storage.d.ts +12 -0
- package/dist/tools/variable_storage.d.ts.map +1 -0
- package/dist/tools/watch_trigger.d.ts +12 -0
- package/dist/tools/watch_trigger.d.ts.map +1 -0
- package/dist/tools/wrapper.d.ts +12 -0
- package/dist/tools/wrapper.d.ts.map +1 -0
- package/dist/types/core.types.d.ts +114 -0
- package/dist/types/core.types.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/llm.types.d.ts +80 -51
- package/dist/types/llm.types.d.ts.map +1 -0
- package/dist/types/mcp.types.d.ts +35 -0
- package/dist/types/mcp.types.d.ts.map +1 -0
- package/dist/types/tools.types.d.ts +56 -152
- package/dist/types/tools.types.d.ts.map +1 -0
- package/package.json +18 -58
- package/dist/common/chrome/proxy.d.ts +0 -24
- package/dist/common/context-compressor.d.ts +0 -10
- package/dist/common/summarize-workflow.d.ts +0 -2
- package/dist/common/tools/cancel_workflow.d.ts +0 -9
- package/dist/common/tools/document_agent.d.ts +0 -8
- package/dist/common/tools/human.d.ts +0 -30
- package/dist/common/tools/index.d.ts +0 -4
- package/dist/common/tools/write_context.d.ts +0 -7
- package/dist/core/eko.d.ts +0 -30
- package/dist/core/tool-registry.d.ts +0 -13
- package/dist/extension/content/index.d.ts +0 -1
- package/dist/extension/core.d.ts +0 -11
- package/dist/extension/index.d.ts +0 -7
- package/dist/extension/script/bing.js +0 -25
- package/dist/extension/script/build_dom_tree.d.ts +0 -38
- package/dist/extension/script/build_dom_tree.js +0 -662
- package/dist/extension/script/common.js +0 -212
- package/dist/extension/script/duckduckgo.js +0 -25
- package/dist/extension/script/google.js +0 -26
- package/dist/extension/tools/browser.d.ts +0 -23
- package/dist/extension/tools/browser_action.d.ts +0 -20
- package/dist/extension/tools/export_file.d.ts +0 -18
- package/dist/extension/tools/extract_content.d.ts +0 -18
- package/dist/extension/tools/get_all_tabs.d.ts +0 -9
- package/dist/extension/tools/html_script.d.ts +0 -10
- package/dist/extension/tools/index.d.ts +0 -12
- package/dist/extension/tools/open_url.d.ts +0 -19
- package/dist/extension/tools/request_login.d.ts +0 -10
- package/dist/extension/tools/screenshot.d.ts +0 -18
- package/dist/extension/tools/switch_tab.d.ts +0 -8
- package/dist/extension/tools/tab_management.d.ts +0 -13
- package/dist/extension/tools/tool_returns_screenshot.d.ts +0 -8
- package/dist/extension/tools/web_search.d.ts +0 -18
- package/dist/extension/utils.d.ts +0 -31
- package/dist/extension.cjs.js +0 -2796
- package/dist/extension.esm.js +0 -2789
- package/dist/extension_content_script.js +0 -1078
- package/dist/fellou/computer.d.ts +0 -20
- package/dist/fellou/index.d.ts +0 -6
- package/dist/fellou/tools/computer_use.d.ts +0 -18
- package/dist/fellou.cjs.js +0 -238
- package/dist/fellou.esm.js +0 -235
- package/dist/models/action.d.ts +0 -33
- package/dist/models/workflow.d.ts +0 -25
- package/dist/nodejs/core.d.ts +0 -2
- package/dist/nodejs/index.d.ts +0 -3
- package/dist/nodejs/script/build_dom_tree.d.ts +0 -1
- package/dist/nodejs/tools/browser_use.d.ts +0 -28
- package/dist/nodejs/tools/command_execute.d.ts +0 -12
- package/dist/nodejs/tools/file_read.d.ts +0 -11
- package/dist/nodejs/tools/file_write.d.ts +0 -15
- package/dist/nodejs/tools/index.d.ts +0 -5
- package/dist/nodejs.cjs.js +0 -73507
- package/dist/nodejs.esm.js +0 -73504
- package/dist/schemas/workflow.schema.d.ts +0 -44
- package/dist/services/llm/claude-provider.d.ts +0 -12
- package/dist/services/llm/openai-provider.d.ts +0 -12
- package/dist/services/llm/provider-factory.d.ts +0 -4
- package/dist/services/parser/workflow-parser.d.ts +0 -23
- package/dist/services/workflow/generator.d.ts +0 -16
- package/dist/services/workflow/templates.d.ts +0 -8
- package/dist/types/action.types.d.ts +0 -53
- package/dist/types/eko.types.d.ts +0 -37
- package/dist/types/parser.types.d.ts +0 -9
- package/dist/types/workflow.types.d.ts +0 -57
- package/dist/utils/execution-logger.d.ts +0 -69
- package/dist/utils/sleep.d.ts +0 -1
- package/dist/web/core.d.ts +0 -2
- package/dist/web/index.d.ts +0 -5
- package/dist/web/script/build_dom_tree.d.ts +0 -10
- package/dist/web/tools/browser.d.ts +0 -21
- package/dist/web/tools/browser_use.d.ts +0 -19
- package/dist/web/tools/export_file.d.ts +0 -18
- package/dist/web/tools/extract_content.d.ts +0 -17
- package/dist/web/tools/html_script.d.ts +0 -10
- package/dist/web/tools/index.d.ts +0 -6
- package/dist/web/tools/screenshot.d.ts +0 -18
- package/dist/web.cjs.js +0 -9952
- package/dist/web.esm.js +0 -9948
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Common JS function
|
|
3
|
-
*/
|
|
4
|
-
if (!window.eko) {
|
|
5
|
-
window.eko = {}
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Extract html content
|
|
10
|
-
*/
|
|
11
|
-
eko.extractHtmlContent = function (element) {
|
|
12
|
-
element = element || document.body
|
|
13
|
-
let main = element.querySelector('main')
|
|
14
|
-
let content = ''
|
|
15
|
-
if (main) {
|
|
16
|
-
let articles = main.querySelectorAll('article')
|
|
17
|
-
if (articles && articles.length > 0) {
|
|
18
|
-
for (let i = 0; i < articles.length; i++) {
|
|
19
|
-
content += articles[i].innerText.trim() + '\n'
|
|
20
|
-
}
|
|
21
|
-
} else {
|
|
22
|
-
content += main.innerText.trim()
|
|
23
|
-
}
|
|
24
|
-
} else {
|
|
25
|
-
let articles = element.querySelectorAll('article')
|
|
26
|
-
if (articles && articles.length > 0) {
|
|
27
|
-
for (let i = 0; i < articles.length; i++) {
|
|
28
|
-
content += articles[i].innerText.trim() + '\n'
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
content = content.trim()
|
|
33
|
-
if (!content) {
|
|
34
|
-
content = element.innerText
|
|
35
|
-
}
|
|
36
|
-
return content.replaceAll(/\n+/g, '\n').replaceAll(/ +/g, ' ').trim()
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Element text (remove consecutive spaces and line breaks)
|
|
41
|
-
*
|
|
42
|
-
* @param {HTMLElement|string} object
|
|
43
|
-
* @returns text
|
|
44
|
-
*/
|
|
45
|
-
eko.cleanText = function(object) {
|
|
46
|
-
let str = (typeof object == 'string') ? object : object?.innerText
|
|
47
|
-
return str ? str.replaceAll(/\s+/g, ' ').trim() : ''
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* sleep
|
|
52
|
-
*
|
|
53
|
-
* @param {number} time millisecond
|
|
54
|
-
*/
|
|
55
|
-
eko.sleep = function(time) {
|
|
56
|
-
return new Promise(resolve => setTimeout(() => resolve(), time))
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* element displayed
|
|
61
|
-
*
|
|
62
|
-
* @param {HTMLElement} element
|
|
63
|
-
*/
|
|
64
|
-
eko.isDisplayed = function (element) {
|
|
65
|
-
return element && window.getComputedStyle(element).getPropertyValue('display') != 'none'
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* click
|
|
70
|
-
*
|
|
71
|
-
* @param {HTMLElement} element
|
|
72
|
-
*/
|
|
73
|
-
eko.click = function(element) {
|
|
74
|
-
if (element.click) {
|
|
75
|
-
element.click()
|
|
76
|
-
} else {
|
|
77
|
-
element.dispatchEvent(new MouseEvent('click', {
|
|
78
|
-
view: window,
|
|
79
|
-
bubbles: true,
|
|
80
|
-
cancelable: true
|
|
81
|
-
}))
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Trigger simulated input
|
|
87
|
-
*/
|
|
88
|
-
eko.sendKeys = function(element, str, clear, keypress) {
|
|
89
|
-
element.focus && element.focus()
|
|
90
|
-
if (clear) {
|
|
91
|
-
if (element.value == undefined) {
|
|
92
|
-
element.textContent = ''
|
|
93
|
-
} else {
|
|
94
|
-
for (let i = 0; i < element.value.length; i++) {
|
|
95
|
-
element.dispatchEvent(new KeyboardEvent('keydown', { key: 'Backspace' }))
|
|
96
|
-
}
|
|
97
|
-
element.value = ''
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (keypress) {
|
|
101
|
-
Array.from(str).forEach(key => {
|
|
102
|
-
element.dispatchEvent(new KeyboardEvent('keypress', { key }))
|
|
103
|
-
})
|
|
104
|
-
element.value += str
|
|
105
|
-
element.dispatchEvent(new Event('input'))
|
|
106
|
-
} else {
|
|
107
|
-
if (element.value == undefined) {
|
|
108
|
-
element.textContent += str
|
|
109
|
-
} else {
|
|
110
|
-
element.value += str
|
|
111
|
-
}
|
|
112
|
-
element.dispatchEvent(new Event('input', { bubbles: true }))
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Waiting for Dom to change
|
|
118
|
-
*/
|
|
119
|
-
eko.waitForDomChanged = function (targetElement, fun, timeout, config, firstExecute) {
|
|
120
|
-
targetElement = targetElement || document.body
|
|
121
|
-
return new Promise((resolve) => {
|
|
122
|
-
if (firstExecute) {
|
|
123
|
-
let result = fun({})
|
|
124
|
-
if (result) {
|
|
125
|
-
resolve(result)
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
var observer = { value: null }
|
|
129
|
-
let timeId = setTimeout(() => {
|
|
130
|
-
observer.value && observer.value.disconnect()
|
|
131
|
-
resolve()
|
|
132
|
-
}, timeout)
|
|
133
|
-
observer.value = new MutationObserver((mutations) => {
|
|
134
|
-
try {
|
|
135
|
-
let result = fun(mutations)
|
|
136
|
-
if (result) {
|
|
137
|
-
clearTimeout(timeId)
|
|
138
|
-
observer.value && observer.value.disconnect()
|
|
139
|
-
resolve(result)
|
|
140
|
-
}
|
|
141
|
-
} catch (e) {}
|
|
142
|
-
});
|
|
143
|
-
if (!config) {
|
|
144
|
-
config = {}
|
|
145
|
-
}
|
|
146
|
-
observer.value.observe(targetElement, { attributes: true, childList: true, subtree: true, ...config })
|
|
147
|
-
})
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Wait for the page to finish loading after onload
|
|
152
|
-
*/
|
|
153
|
-
eko.waitLoaded = async function() {
|
|
154
|
-
await eko.waitForDomChanged(document.body, () => document.readyState == 'complete', 5000, {}, true)
|
|
155
|
-
await eko.sleep(500)
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Wait for the element to present
|
|
160
|
-
*/
|
|
161
|
-
eko.waitForElementPresent = function (targetElement, cssSelector, timeout) {
|
|
162
|
-
targetElement = targetElement || document.body
|
|
163
|
-
return eko.waitForDomChanged(targetElement, () => targetElement.querySelector(cssSelector), timeout, { attributes: false }, true)
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Wait for the element to displayed
|
|
168
|
-
*/
|
|
169
|
-
eko.waitForElementDisplayed = function (targetElement, cssSelector, timeout) {
|
|
170
|
-
targetElement = targetElement || document.body
|
|
171
|
-
return eko.waitForDomChanged(targetElement, () => {
|
|
172
|
-
let element = targetElement.querySelector(cssSelector)
|
|
173
|
-
if (element) {
|
|
174
|
-
let visibility = window.getComputedStyle(element).getPropertyValue('display')
|
|
175
|
-
if (visibility != 'none') {
|
|
176
|
-
return element
|
|
177
|
-
} else {
|
|
178
|
-
return false
|
|
179
|
-
}
|
|
180
|
-
} else {
|
|
181
|
-
return false
|
|
182
|
-
}
|
|
183
|
-
}, timeout, {}, true)
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Wait for the element to present
|
|
188
|
-
*/
|
|
189
|
-
eko.waitForElementNotPresent = function (targetElement, cssSelector, timeout) {
|
|
190
|
-
targetElement = targetElement || document.body
|
|
191
|
-
return eko.waitForDomChanged(targetElement, () => !targetElement.querySelector(cssSelector), timeout, { attributes: false }, true)
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Waiting for element to be invisible
|
|
196
|
-
*/
|
|
197
|
-
eko.waitForElementNotDisplayed = function (targetElement, cssSelector, timeout) {
|
|
198
|
-
targetElement = targetElement || document.body
|
|
199
|
-
return eko.waitForDomChanged(targetElement, () => {
|
|
200
|
-
let element = targetElement.querySelector(cssSelector)
|
|
201
|
-
if (element) {
|
|
202
|
-
let visibility = window.getComputedStyle(element).getPropertyValue('display')
|
|
203
|
-
if (visibility != 'none') {
|
|
204
|
-
return false
|
|
205
|
-
} else {
|
|
206
|
-
return true
|
|
207
|
-
}
|
|
208
|
-
} else {
|
|
209
|
-
return true
|
|
210
|
-
}
|
|
211
|
-
}, timeout, {}, true)
|
|
212
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
eko.getDetailLinks = async function (search) {
|
|
3
|
-
await eko.waitForElementPresent(document.body, 'section h2 a', 5000)
|
|
4
|
-
let search_list = document.querySelectorAll('section h2 a')
|
|
5
|
-
if (search_list.length === 0) {
|
|
6
|
-
search_list = document.querySelectorAll('h2 a')
|
|
7
|
-
}
|
|
8
|
-
let links = []
|
|
9
|
-
for (let i = 0; i < search_list.length; i++) {
|
|
10
|
-
let title = eko.cleanText(search_list[i])
|
|
11
|
-
let url = search_list[i].getAttribute('href')
|
|
12
|
-
links.push({ title, url })
|
|
13
|
-
}
|
|
14
|
-
return {
|
|
15
|
-
links: links
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
eko.getContent = async function (search) {
|
|
20
|
-
await eko.waitLoaded()
|
|
21
|
-
return {
|
|
22
|
-
title: document.title,
|
|
23
|
-
content: eko.extractHtmlContent()
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
eko.getDetailLinks = async function (search) {
|
|
3
|
-
let search_div = await eko.waitForElementPresent(document.body, '#search', 5000)
|
|
4
|
-
if (!search_div) {
|
|
5
|
-
search_div = document.body
|
|
6
|
-
}
|
|
7
|
-
let links = []
|
|
8
|
-
let elements = search_div.querySelectorAll('a:has(h3)')
|
|
9
|
-
for (let i = 0; i < elements.length; i++) {
|
|
10
|
-
let h3 = elements[i].querySelector('h3')
|
|
11
|
-
let title = eko.cleanText(h3)
|
|
12
|
-
let url = elements[i].getAttribute('href')
|
|
13
|
-
links.push({ title, url })
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
links: links
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
eko.getContent = async function (search) {
|
|
21
|
-
await eko.waitLoaded()
|
|
22
|
-
return {
|
|
23
|
-
title: document.title,
|
|
24
|
-
content: eko.extractHtmlContent()
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ScreenshotResult } from '../../types/tools.types';
|
|
2
|
-
export declare function type(chromeProxy: any, tabId: number, text: string, coordinate?: [number, number]): Promise<any>;
|
|
3
|
-
export declare function type_by(chromeProxy: any, tabId: number, text: string, xpath?: string, highlightIndex?: number): Promise<any>;
|
|
4
|
-
export declare function enter_by(chromeProxy: any, tabId: number, xpath?: string, highlightIndex?: number): Promise<any>;
|
|
5
|
-
export declare function clear_input(chromeProxy: any, tabId: number, coordinate?: [number, number]): Promise<any>;
|
|
6
|
-
export declare function clear_input_by(chromeProxy: any, tabId: number, xpath?: string, highlightIndex?: number): Promise<any>;
|
|
7
|
-
export declare function mouse_move(chromeProxy: any, tabId: number, coordinate: [number, number]): Promise<any>;
|
|
8
|
-
export declare function left_click(chromeProxy: any, tabId: number, coordinate?: [number, number]): Promise<any>;
|
|
9
|
-
export declare function left_click_by(chromeProxy: any, tabId: number, xpath?: string, highlightIndex?: number): Promise<any>;
|
|
10
|
-
export declare function right_click(chromeProxy: any, tabId: number, coordinate?: [number, number]): Promise<any>;
|
|
11
|
-
export declare function right_click_by(chromeProxy: any, tabId: number, xpath?: string, highlightIndex?: number): Promise<any>;
|
|
12
|
-
export declare function double_click(chromeProxy: any, tabId: number, coordinate?: [number, number]): Promise<any>;
|
|
13
|
-
export declare function double_click_by(chromeProxy: any, tabId: number, xpath?: string, highlightIndex?: number): Promise<any>;
|
|
14
|
-
export declare function screenshot(chromeProxy: any, windowId: number, compress?: boolean): Promise<ScreenshotResult>;
|
|
15
|
-
export declare function compress_image(dataUrl: string, scale?: number, quality?: number): Promise<string>;
|
|
16
|
-
export declare function scroll_to(chromeProxy: any, tabId: number, coordinate: [number, number]): Promise<any>;
|
|
17
|
-
export declare function scroll_to_by(chromeProxy: any, tabId: number, xpath?: string, highlightIndex?: number): Promise<any>;
|
|
18
|
-
export declare function get_dropdown_options(chromeProxy: any, tabId: number, xpath?: string, highlightIndex?: number): Promise<any>;
|
|
19
|
-
export declare function select_dropdown_option(chromeProxy: any, tabId: number, text: string, xpath?: string, highlightIndex?: number): Promise<any>;
|
|
20
|
-
export declare function cursor_position(chromeProxy: any, tabId: number): Promise<{
|
|
21
|
-
coordinate: [number, number];
|
|
22
|
-
}>;
|
|
23
|
-
export declare function size(chromeProxy: any, tabId?: number): Promise<[number, number]>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { BrowserActionParam, BrowserActionResult } from '../../types/tools.types';
|
|
2
|
-
import { InputSchema, ExecutionContext } from '../../types/action.types';
|
|
3
|
-
import { ToolReturnsScreenshot } from './tool_returns_screenshot';
|
|
4
|
-
/**
|
|
5
|
-
* Browser Use for general
|
|
6
|
-
*/
|
|
7
|
-
export declare class BrowserAction extends ToolReturnsScreenshot<BrowserActionParam> {
|
|
8
|
-
name: string;
|
|
9
|
-
description: string;
|
|
10
|
-
input_schema: InputSchema;
|
|
11
|
-
constructor();
|
|
12
|
-
/**
|
|
13
|
-
* browser
|
|
14
|
-
*
|
|
15
|
-
* @param {*} params { action: 'input_text', index: 1, text: 'string' }
|
|
16
|
-
* @returns > { success: true, image?: { type: 'base64', media_type: 'image/jpeg', data: '/9j...' }, text?: string }
|
|
17
|
-
*/
|
|
18
|
-
realExecute(context: ExecutionContext, params: BrowserActionParam): Promise<BrowserActionResult>;
|
|
19
|
-
destroy(context: ExecutionContext): void;
|
|
20
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ExportFileParam } from '../../types/tools.types';
|
|
2
|
-
import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
|
|
3
|
-
/**
|
|
4
|
-
* Export file
|
|
5
|
-
*/
|
|
6
|
-
export declare class ExportFile implements Tool<ExportFileParam, unknown> {
|
|
7
|
-
name: string;
|
|
8
|
-
description: string;
|
|
9
|
-
input_schema: InputSchema;
|
|
10
|
-
constructor();
|
|
11
|
-
/**
|
|
12
|
-
* export
|
|
13
|
-
*
|
|
14
|
-
* @param {*} params { fileType: 'csv', content: 'field1,field2\ndata1,data2' }
|
|
15
|
-
* @returns > { success: true }
|
|
16
|
-
*/
|
|
17
|
-
execute(context: ExecutionContext, params: ExportFileParam): Promise<unknown>;
|
|
18
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ExtractContentResult } from '../../types/tools.types';
|
|
2
|
-
import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
|
|
3
|
-
/**
|
|
4
|
-
* Extract Page Content
|
|
5
|
-
*/
|
|
6
|
-
export declare class ExtractContent implements Tool<any, ExtractContentResult> {
|
|
7
|
-
name: string;
|
|
8
|
-
description: string;
|
|
9
|
-
input_schema: InputSchema;
|
|
10
|
-
constructor();
|
|
11
|
-
/**
|
|
12
|
-
* Extract Page Content
|
|
13
|
-
*
|
|
14
|
-
* @param {*} params {}
|
|
15
|
-
* @returns > { tabId, result: { title, url, content }, success: true }
|
|
16
|
-
*/
|
|
17
|
-
execute(context: ExecutionContext, params: any): Promise<ExtractContentResult>;
|
|
18
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { BrowserTab } from '../../types/tools.types';
|
|
2
|
-
import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
|
|
3
|
-
export declare class GetAllTabs implements Tool<any, BrowserTab[]> {
|
|
4
|
-
name: string;
|
|
5
|
-
description: string;
|
|
6
|
-
input_schema: InputSchema;
|
|
7
|
-
constructor();
|
|
8
|
-
execute(context: ExecutionContext, params: any): Promise<BrowserTab[]>;
|
|
9
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ElementRect } from '../../types/tools.types';
|
|
2
|
-
export declare function exportFile(filename: string, type: string, content: string): void;
|
|
3
|
-
export declare function xpath(element: any): string;
|
|
4
|
-
export declare function queryWithXpath(xpath: string): any;
|
|
5
|
-
/**
|
|
6
|
-
* Extract the elements related to html operability and wrap them into pseudo-html code.
|
|
7
|
-
*/
|
|
8
|
-
export declare function extractOperableElements(): string;
|
|
9
|
-
export declare function clickOperableElement(id: any): any;
|
|
10
|
-
export declare function getOperableElementRect(id: any): ElementRect | null;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { BrowserAction } from './browser_action';
|
|
2
|
-
import { ExportFile } from './export_file';
|
|
3
|
-
import { ExtractContent } from './extract_content';
|
|
4
|
-
import { GetAllTabs } from './get_all_tabs';
|
|
5
|
-
import { OpenUrl } from './open_url';
|
|
6
|
-
import { Screenshot } from './screenshot';
|
|
7
|
-
import { TabManagement } from './tab_management';
|
|
8
|
-
import { WebSearch } from './web_search';
|
|
9
|
-
import { RequestLogin } from './request_login';
|
|
10
|
-
import { SwitchTab } from './switch_tab';
|
|
11
|
-
export * from '../../common/tools';
|
|
12
|
-
export { BrowserAction, ExportFile, ExtractContent, OpenUrl, GetAllTabs, Screenshot, TabManagement, WebSearch, RequestLogin, SwitchTab, };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { OpenUrlParam, OpenUrlResult } from '../../types/tools.types';
|
|
2
|
-
import { InputSchema, ExecutionContext } from '../../types/action.types';
|
|
3
|
-
import { ToolReturnsScreenshot } from './tool_returns_screenshot';
|
|
4
|
-
/**
|
|
5
|
-
* Open Url
|
|
6
|
-
*/
|
|
7
|
-
export declare class OpenUrl extends ToolReturnsScreenshot<OpenUrlParam> {
|
|
8
|
-
name: string;
|
|
9
|
-
description: string;
|
|
10
|
-
input_schema: InputSchema;
|
|
11
|
-
constructor();
|
|
12
|
-
/**
|
|
13
|
-
* Open Url
|
|
14
|
-
*
|
|
15
|
-
* @param {*} params { url: 'https://www.google.com', newWindow: true }
|
|
16
|
-
* @returns > { tabId, windowId, title, success: true }
|
|
17
|
-
*/
|
|
18
|
-
realExecute(context: ExecutionContext, params: OpenUrlParam): Promise<OpenUrlResult>;
|
|
19
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
|
|
2
|
-
export declare class RequestLogin implements Tool<any, any> {
|
|
3
|
-
name: string;
|
|
4
|
-
description: string;
|
|
5
|
-
input_schema: InputSchema;
|
|
6
|
-
constructor();
|
|
7
|
-
execute(context: ExecutionContext, params: any): Promise<any>;
|
|
8
|
-
awaitLogin(chromeProxy: any, tabId: number, task_id: string): Promise<boolean>;
|
|
9
|
-
isLoginIn(context: ExecutionContext): Promise<boolean>;
|
|
10
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
|
|
2
|
-
import { ScreenshotResult } from '../../types/tools.types';
|
|
3
|
-
/**
|
|
4
|
-
* Current Page Screenshot
|
|
5
|
-
*/
|
|
6
|
-
export declare class Screenshot implements Tool<any, ScreenshotResult> {
|
|
7
|
-
name: string;
|
|
8
|
-
description: string;
|
|
9
|
-
input_schema: InputSchema;
|
|
10
|
-
constructor();
|
|
11
|
-
/**
|
|
12
|
-
* Current Page Screenshot
|
|
13
|
-
*
|
|
14
|
-
* @param {*} params {}
|
|
15
|
-
* @returns > { image: { type: 'base64', media_type: 'image/png', data } }
|
|
16
|
-
*/
|
|
17
|
-
execute(context: ExecutionContext, params: unknown): Promise<ScreenshotResult>;
|
|
18
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ExecutionContext, InputSchema, SwitchTabParam, TabManagementResult, Tool } from '@/types';
|
|
2
|
-
export declare class SwitchTab implements Tool<SwitchTabParam, TabManagementResult> {
|
|
3
|
-
description: string;
|
|
4
|
-
input_schema: InputSchema;
|
|
5
|
-
name: string;
|
|
6
|
-
constructor();
|
|
7
|
-
execute(context: ExecutionContext, params: SwitchTabParam): Promise<TabManagementResult>;
|
|
8
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { TabManagementParam, TabManagementResult } from '../../types/tools.types';
|
|
2
|
-
import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
|
|
3
|
-
/**
|
|
4
|
-
* Browser tab management
|
|
5
|
-
*/
|
|
6
|
-
export declare class TabManagement implements Tool<TabManagementParam, TabManagementResult> {
|
|
7
|
-
name: string;
|
|
8
|
-
description: string;
|
|
9
|
-
input_schema: InputSchema;
|
|
10
|
-
constructor();
|
|
11
|
-
execute(context: ExecutionContext, params: TabManagementParam): Promise<TabManagementResult>;
|
|
12
|
-
destroy(context: ExecutionContext): void;
|
|
13
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { BrowserActionResult, ExecutionContext, InputSchema, Tool } from "@/types";
|
|
2
|
-
export declare abstract class ToolReturnsScreenshot<T> implements Tool<T, BrowserActionResult> {
|
|
3
|
-
abstract name: string;
|
|
4
|
-
abstract description: string;
|
|
5
|
-
abstract input_schema: InputSchema;
|
|
6
|
-
abstract realExecute(context: ExecutionContext, params: T): Promise<any>;
|
|
7
|
-
execute(context: ExecutionContext, params: T): Promise<BrowserActionResult>;
|
|
8
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { WebSearchParam, WebSearchResult } from '../../types/tools.types';
|
|
2
|
-
import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
|
|
3
|
-
/**
|
|
4
|
-
* Web Search
|
|
5
|
-
*/
|
|
6
|
-
export declare class WebSearch implements Tool<WebSearchParam, WebSearchResult[]> {
|
|
7
|
-
name: string;
|
|
8
|
-
description: string;
|
|
9
|
-
input_schema: InputSchema;
|
|
10
|
-
constructor();
|
|
11
|
-
/**
|
|
12
|
-
* search
|
|
13
|
-
*
|
|
14
|
-
* @param {*} params { url: 'https://www.google.com', query: 'ai agent', maxResults: 5 }
|
|
15
|
-
* @returns > [{ title, url, content }]
|
|
16
|
-
*/
|
|
17
|
-
execute(context: ExecutionContext, params: WebSearchParam): Promise<WebSearchResult[]>;
|
|
18
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ExecutionContext } from '../types/action.types';
|
|
2
|
-
export declare function getWindowId(context: ExecutionContext): Promise<number>;
|
|
3
|
-
export declare function getTabId(context: ExecutionContext): Promise<number>;
|
|
4
|
-
export declare function getCurrentTabId(chromeProxy: any, windowId?: number | undefined): Promise<number | undefined>;
|
|
5
|
-
export declare function open_new_tab(chromeProxy: any, url: string, windowId?: number): Promise<chrome.tabs.Tab>;
|
|
6
|
-
export declare function executeScript(chromeProxy: any, tabId: number, func: any, args: any[]): Promise<any>;
|
|
7
|
-
export declare function waitForTabComplete(chromeProxy: any, tabId: number, timeout?: number): Promise<chrome.tabs.Tab>;
|
|
8
|
-
export declare function doesTabExists(chromeProxy: any, tabId: number): Promise<unknown>;
|
|
9
|
-
export declare function getPageSize(chromeProxy: any, tabId?: number): Promise<[number, number]>;
|
|
10
|
-
export declare function sleep(time: number): Promise<void>;
|
|
11
|
-
export declare function injectScript(chromeProxy: any, tabId: number, filename?: string): Promise<void>;
|
|
12
|
-
export declare class MsgEvent {
|
|
13
|
-
eventMap: {
|
|
14
|
-
[key: string]: Function;
|
|
15
|
-
};
|
|
16
|
-
constructor();
|
|
17
|
-
addListener(callback: Function, id: string): string;
|
|
18
|
-
removeListener(id: string): void;
|
|
19
|
-
publish(msg: any): Promise<void>;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Counter (Function: Wait for all asynchronous tasks to complete)
|
|
23
|
-
*/
|
|
24
|
-
export declare class CountDownLatch {
|
|
25
|
-
resolve?: Function;
|
|
26
|
-
currentCount: number;
|
|
27
|
-
constructor(count: number);
|
|
28
|
-
countDown(): void;
|
|
29
|
-
await(timeout: number): Promise<void>;
|
|
30
|
-
}
|
|
31
|
-
export declare function isPromise(obj: any): boolean;
|