@eko-ai/eko 1.0.3 → 1.0.5
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/dist/core/eko.d.ts +2 -2
- package/dist/extension/core.d.ts +1 -1
- package/dist/extension/index.d.ts +2 -0
- package/dist/extension/utils.d.ts +1 -1
- package/dist/extension.cjs.js +99 -7
- package/dist/extension.esm.js +98 -7
- package/dist/index.cjs.js +28 -2
- package/dist/index.esm.js +28 -2
- package/dist/nodejs/core.d.ts +1 -1
- package/dist/nodejs.cjs.js +2 -2
- package/dist/nodejs.esm.js +2 -2
- package/dist/web/core.d.ts +1 -1
- package/dist/web/index.d.ts +2 -0
- package/dist/web.cjs.js +18 -2
- package/dist/web.esm.js +17 -2
- package/package.json +1 -1
package/dist/core/eko.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ export declare class Eko {
|
|
|
7
7
|
private llmProvider;
|
|
8
8
|
private toolRegistry;
|
|
9
9
|
constructor(config: EkoConfig);
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
generate(prompt: string, param?: EkoInvokeParam): Promise<Workflow>;
|
|
11
|
+
execute(workflow: Workflow, callback?: WorkflowCallback): Promise<void>;
|
|
12
12
|
private getTool;
|
|
13
13
|
callTool(toolName: string, input: object, callback?: WorkflowCallback): Promise<any>;
|
|
14
14
|
callTool(tool: Tool<any, any>, input: object, callback?: WorkflowCallback): Promise<any>;
|
package/dist/extension/core.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExecutionContext } from '../types/action.types';
|
|
2
2
|
export declare function getWindowId(context: ExecutionContext): Promise<number>;
|
|
3
3
|
export declare function getTabId(context: ExecutionContext): Promise<number>;
|
|
4
|
-
export declare function getCurrentTabId(): Promise<number | undefined>;
|
|
4
|
+
export declare function getCurrentTabId(windowId?: number | undefined): Promise<number | undefined>;
|
|
5
5
|
export declare function open_new_tab(url: string, newWindow: boolean, windowId?: number): Promise<chrome.tabs.Tab>;
|
|
6
6
|
export declare function executeScript(tabId: number, func: any, args: any[]): Promise<any>;
|
|
7
7
|
export declare function waitForTabComplete(tabId: number, timeout?: number): Promise<chrome.tabs.Tab>;
|
package/dist/extension.cjs.js
CHANGED
|
@@ -39,24 +39,36 @@ async function getTabId(context) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
if (!tabId) {
|
|
42
|
-
|
|
42
|
+
let windowId = context.variables.get('windowId');
|
|
43
|
+
if (windowId) {
|
|
44
|
+
try {
|
|
45
|
+
tabId = await getCurrentTabId(windowId);
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
tabId = await getCurrentTabId();
|
|
49
|
+
context.variables.delete('windowId');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
tabId = await getCurrentTabId();
|
|
54
|
+
}
|
|
43
55
|
}
|
|
44
56
|
return tabId;
|
|
45
57
|
}
|
|
46
|
-
function getCurrentTabId() {
|
|
58
|
+
function getCurrentTabId(windowId) {
|
|
47
59
|
return new Promise((resolve) => {
|
|
48
|
-
chrome.tabs.query({ active: true, lastFocusedWindow: true }, function (tabs) {
|
|
60
|
+
chrome.tabs.query({ windowId, active: true, lastFocusedWindow: true }, function (tabs) {
|
|
49
61
|
if (tabs.length > 0) {
|
|
50
62
|
resolve(tabs[0].id);
|
|
51
63
|
}
|
|
52
64
|
else {
|
|
53
|
-
chrome.tabs.query({ active: true, currentWindow: true }, function (_tabs) {
|
|
65
|
+
chrome.tabs.query({ windowId, active: true, currentWindow: true }, function (_tabs) {
|
|
54
66
|
if (_tabs.length > 0) {
|
|
55
67
|
resolve(_tabs[0].id);
|
|
56
68
|
return;
|
|
57
69
|
}
|
|
58
70
|
else {
|
|
59
|
-
chrome.tabs.query({ status: 'complete', currentWindow: true }, function (__tabs) {
|
|
71
|
+
chrome.tabs.query({ windowId, status: 'complete', currentWindow: true }, function (__tabs) {
|
|
60
72
|
resolve(__tabs.length ? __tabs[__tabs.length - 1].id : undefined);
|
|
61
73
|
});
|
|
62
74
|
}
|
|
@@ -235,6 +247,17 @@ var utils = /*#__PURE__*/Object.freeze({
|
|
|
235
247
|
waitForTabComplete: waitForTabComplete
|
|
236
248
|
});
|
|
237
249
|
|
|
250
|
+
async function type(tabId, text, coordinate) {
|
|
251
|
+
if (!coordinate) {
|
|
252
|
+
coordinate = (await cursor_position(tabId)).coordinate;
|
|
253
|
+
}
|
|
254
|
+
await mouse_move(tabId, coordinate);
|
|
255
|
+
return await chrome.tabs.sendMessage(tabId, {
|
|
256
|
+
type: 'computer:type',
|
|
257
|
+
text,
|
|
258
|
+
coordinate,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
238
261
|
async function type_by(tabId, text, xpath, highlightIndex) {
|
|
239
262
|
return await chrome.tabs.sendMessage(tabId, {
|
|
240
263
|
type: 'computer:type',
|
|
@@ -243,6 +266,17 @@ async function type_by(tabId, text, xpath, highlightIndex) {
|
|
|
243
266
|
highlightIndex,
|
|
244
267
|
});
|
|
245
268
|
}
|
|
269
|
+
async function clear_input(tabId, coordinate) {
|
|
270
|
+
if (!coordinate) {
|
|
271
|
+
coordinate = (await cursor_position(tabId)).coordinate;
|
|
272
|
+
}
|
|
273
|
+
await mouse_move(tabId, coordinate);
|
|
274
|
+
return await chrome.tabs.sendMessage(tabId, {
|
|
275
|
+
type: 'computer:type',
|
|
276
|
+
text: '',
|
|
277
|
+
coordinate,
|
|
278
|
+
});
|
|
279
|
+
}
|
|
246
280
|
async function clear_input_by(tabId, xpath, highlightIndex) {
|
|
247
281
|
return await chrome.tabs.sendMessage(tabId, {
|
|
248
282
|
type: 'computer:type',
|
|
@@ -251,6 +285,12 @@ async function clear_input_by(tabId, xpath, highlightIndex) {
|
|
|
251
285
|
highlightIndex,
|
|
252
286
|
});
|
|
253
287
|
}
|
|
288
|
+
async function mouse_move(tabId, coordinate) {
|
|
289
|
+
return await chrome.tabs.sendMessage(tabId, {
|
|
290
|
+
type: 'computer:mouse_move',
|
|
291
|
+
coordinate,
|
|
292
|
+
});
|
|
293
|
+
}
|
|
254
294
|
async function left_click(tabId, coordinate) {
|
|
255
295
|
if (!coordinate) {
|
|
256
296
|
coordinate = (await cursor_position(tabId)).coordinate;
|
|
@@ -267,6 +307,15 @@ async function left_click_by(tabId, xpath, highlightIndex) {
|
|
|
267
307
|
highlightIndex,
|
|
268
308
|
});
|
|
269
309
|
}
|
|
310
|
+
async function right_click(tabId, coordinate) {
|
|
311
|
+
if (!coordinate) {
|
|
312
|
+
coordinate = (await cursor_position(tabId)).coordinate;
|
|
313
|
+
}
|
|
314
|
+
return await chrome.tabs.sendMessage(tabId, {
|
|
315
|
+
type: 'computer:right_click',
|
|
316
|
+
coordinate,
|
|
317
|
+
});
|
|
318
|
+
}
|
|
270
319
|
async function right_click_by(tabId, xpath, highlightIndex) {
|
|
271
320
|
return await chrome.tabs.sendMessage(tabId, {
|
|
272
321
|
type: 'computer:right_click',
|
|
@@ -274,6 +323,15 @@ async function right_click_by(tabId, xpath, highlightIndex) {
|
|
|
274
323
|
highlightIndex,
|
|
275
324
|
});
|
|
276
325
|
}
|
|
326
|
+
async function double_click(tabId, coordinate) {
|
|
327
|
+
if (!coordinate) {
|
|
328
|
+
coordinate = (await cursor_position(tabId)).coordinate;
|
|
329
|
+
}
|
|
330
|
+
return await chrome.tabs.sendMessage(tabId, {
|
|
331
|
+
type: 'computer:double_click',
|
|
332
|
+
coordinate,
|
|
333
|
+
});
|
|
334
|
+
}
|
|
277
335
|
async function double_click_by(tabId, xpath, highlightIndex) {
|
|
278
336
|
return await chrome.tabs.sendMessage(tabId, {
|
|
279
337
|
type: 'computer:double_click',
|
|
@@ -295,6 +353,14 @@ async function screenshot(windowId) {
|
|
|
295
353
|
},
|
|
296
354
|
};
|
|
297
355
|
}
|
|
356
|
+
async function scroll_to(tabId, coordinate) {
|
|
357
|
+
let from_coordinate = (await cursor_position(tabId)).coordinate;
|
|
358
|
+
return await chrome.tabs.sendMessage(tabId, {
|
|
359
|
+
type: 'computer:scroll_to',
|
|
360
|
+
from_coordinate,
|
|
361
|
+
to_coordinate: coordinate,
|
|
362
|
+
});
|
|
363
|
+
}
|
|
298
364
|
async function scroll_to_by(tabId, xpath, highlightIndex) {
|
|
299
365
|
return await chrome.tabs.sendMessage(tabId, {
|
|
300
366
|
type: 'computer:scroll_to',
|
|
@@ -323,6 +389,31 @@ async function cursor_position(tabId) {
|
|
|
323
389
|
});
|
|
324
390
|
return { coordinate: result.coordinate };
|
|
325
391
|
}
|
|
392
|
+
async function size(tabId) {
|
|
393
|
+
return await getPageSize(tabId);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
var browser = /*#__PURE__*/Object.freeze({
|
|
397
|
+
__proto__: null,
|
|
398
|
+
clear_input: clear_input,
|
|
399
|
+
clear_input_by: clear_input_by,
|
|
400
|
+
cursor_position: cursor_position,
|
|
401
|
+
double_click: double_click,
|
|
402
|
+
double_click_by: double_click_by,
|
|
403
|
+
get_dropdown_options: get_dropdown_options,
|
|
404
|
+
left_click: left_click,
|
|
405
|
+
left_click_by: left_click_by,
|
|
406
|
+
mouse_move: mouse_move,
|
|
407
|
+
right_click: right_click,
|
|
408
|
+
right_click_by: right_click_by,
|
|
409
|
+
screenshot: screenshot,
|
|
410
|
+
scroll_to: scroll_to,
|
|
411
|
+
scroll_to_by: scroll_to_by,
|
|
412
|
+
select_dropdown_option: select_dropdown_option,
|
|
413
|
+
size: size,
|
|
414
|
+
type: type,
|
|
415
|
+
type_by: type_by
|
|
416
|
+
});
|
|
326
417
|
|
|
327
418
|
/**
|
|
328
419
|
* Browser Use for general
|
|
@@ -1584,7 +1675,7 @@ async function getLLMConfig(name = 'llmConfig') {
|
|
|
1584
1675
|
let result = await chrome.storage.sync.get([name]);
|
|
1585
1676
|
return result[name];
|
|
1586
1677
|
}
|
|
1587
|
-
function
|
|
1678
|
+
function loadTools() {
|
|
1588
1679
|
let toolsMap = new Map();
|
|
1589
1680
|
for (const key in tools) {
|
|
1590
1681
|
let tool = tools[key];
|
|
@@ -1601,8 +1692,9 @@ function getAllTools() {
|
|
|
1601
1692
|
return toolsMap;
|
|
1602
1693
|
}
|
|
1603
1694
|
|
|
1604
|
-
exports.
|
|
1695
|
+
exports.browser = browser;
|
|
1605
1696
|
exports.getLLMConfig = getLLMConfig;
|
|
1697
|
+
exports.loadTools = loadTools;
|
|
1606
1698
|
exports.pub = pub;
|
|
1607
1699
|
exports.tools = tools;
|
|
1608
1700
|
exports.utils = utils;
|
package/dist/extension.esm.js
CHANGED
|
@@ -37,24 +37,36 @@ async function getTabId(context) {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
if (!tabId) {
|
|
40
|
-
|
|
40
|
+
let windowId = context.variables.get('windowId');
|
|
41
|
+
if (windowId) {
|
|
42
|
+
try {
|
|
43
|
+
tabId = await getCurrentTabId(windowId);
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
tabId = await getCurrentTabId();
|
|
47
|
+
context.variables.delete('windowId');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
tabId = await getCurrentTabId();
|
|
52
|
+
}
|
|
41
53
|
}
|
|
42
54
|
return tabId;
|
|
43
55
|
}
|
|
44
|
-
function getCurrentTabId() {
|
|
56
|
+
function getCurrentTabId(windowId) {
|
|
45
57
|
return new Promise((resolve) => {
|
|
46
|
-
chrome.tabs.query({ active: true, lastFocusedWindow: true }, function (tabs) {
|
|
58
|
+
chrome.tabs.query({ windowId, active: true, lastFocusedWindow: true }, function (tabs) {
|
|
47
59
|
if (tabs.length > 0) {
|
|
48
60
|
resolve(tabs[0].id);
|
|
49
61
|
}
|
|
50
62
|
else {
|
|
51
|
-
chrome.tabs.query({ active: true, currentWindow: true }, function (_tabs) {
|
|
63
|
+
chrome.tabs.query({ windowId, active: true, currentWindow: true }, function (_tabs) {
|
|
52
64
|
if (_tabs.length > 0) {
|
|
53
65
|
resolve(_tabs[0].id);
|
|
54
66
|
return;
|
|
55
67
|
}
|
|
56
68
|
else {
|
|
57
|
-
chrome.tabs.query({ status: 'complete', currentWindow: true }, function (__tabs) {
|
|
69
|
+
chrome.tabs.query({ windowId, status: 'complete', currentWindow: true }, function (__tabs) {
|
|
58
70
|
resolve(__tabs.length ? __tabs[__tabs.length - 1].id : undefined);
|
|
59
71
|
});
|
|
60
72
|
}
|
|
@@ -233,6 +245,17 @@ var utils = /*#__PURE__*/Object.freeze({
|
|
|
233
245
|
waitForTabComplete: waitForTabComplete
|
|
234
246
|
});
|
|
235
247
|
|
|
248
|
+
async function type(tabId, text, coordinate) {
|
|
249
|
+
if (!coordinate) {
|
|
250
|
+
coordinate = (await cursor_position(tabId)).coordinate;
|
|
251
|
+
}
|
|
252
|
+
await mouse_move(tabId, coordinate);
|
|
253
|
+
return await chrome.tabs.sendMessage(tabId, {
|
|
254
|
+
type: 'computer:type',
|
|
255
|
+
text,
|
|
256
|
+
coordinate,
|
|
257
|
+
});
|
|
258
|
+
}
|
|
236
259
|
async function type_by(tabId, text, xpath, highlightIndex) {
|
|
237
260
|
return await chrome.tabs.sendMessage(tabId, {
|
|
238
261
|
type: 'computer:type',
|
|
@@ -241,6 +264,17 @@ async function type_by(tabId, text, xpath, highlightIndex) {
|
|
|
241
264
|
highlightIndex,
|
|
242
265
|
});
|
|
243
266
|
}
|
|
267
|
+
async function clear_input(tabId, coordinate) {
|
|
268
|
+
if (!coordinate) {
|
|
269
|
+
coordinate = (await cursor_position(tabId)).coordinate;
|
|
270
|
+
}
|
|
271
|
+
await mouse_move(tabId, coordinate);
|
|
272
|
+
return await chrome.tabs.sendMessage(tabId, {
|
|
273
|
+
type: 'computer:type',
|
|
274
|
+
text: '',
|
|
275
|
+
coordinate,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
244
278
|
async function clear_input_by(tabId, xpath, highlightIndex) {
|
|
245
279
|
return await chrome.tabs.sendMessage(tabId, {
|
|
246
280
|
type: 'computer:type',
|
|
@@ -249,6 +283,12 @@ async function clear_input_by(tabId, xpath, highlightIndex) {
|
|
|
249
283
|
highlightIndex,
|
|
250
284
|
});
|
|
251
285
|
}
|
|
286
|
+
async function mouse_move(tabId, coordinate) {
|
|
287
|
+
return await chrome.tabs.sendMessage(tabId, {
|
|
288
|
+
type: 'computer:mouse_move',
|
|
289
|
+
coordinate,
|
|
290
|
+
});
|
|
291
|
+
}
|
|
252
292
|
async function left_click(tabId, coordinate) {
|
|
253
293
|
if (!coordinate) {
|
|
254
294
|
coordinate = (await cursor_position(tabId)).coordinate;
|
|
@@ -265,6 +305,15 @@ async function left_click_by(tabId, xpath, highlightIndex) {
|
|
|
265
305
|
highlightIndex,
|
|
266
306
|
});
|
|
267
307
|
}
|
|
308
|
+
async function right_click(tabId, coordinate) {
|
|
309
|
+
if (!coordinate) {
|
|
310
|
+
coordinate = (await cursor_position(tabId)).coordinate;
|
|
311
|
+
}
|
|
312
|
+
return await chrome.tabs.sendMessage(tabId, {
|
|
313
|
+
type: 'computer:right_click',
|
|
314
|
+
coordinate,
|
|
315
|
+
});
|
|
316
|
+
}
|
|
268
317
|
async function right_click_by(tabId, xpath, highlightIndex) {
|
|
269
318
|
return await chrome.tabs.sendMessage(tabId, {
|
|
270
319
|
type: 'computer:right_click',
|
|
@@ -272,6 +321,15 @@ async function right_click_by(tabId, xpath, highlightIndex) {
|
|
|
272
321
|
highlightIndex,
|
|
273
322
|
});
|
|
274
323
|
}
|
|
324
|
+
async function double_click(tabId, coordinate) {
|
|
325
|
+
if (!coordinate) {
|
|
326
|
+
coordinate = (await cursor_position(tabId)).coordinate;
|
|
327
|
+
}
|
|
328
|
+
return await chrome.tabs.sendMessage(tabId, {
|
|
329
|
+
type: 'computer:double_click',
|
|
330
|
+
coordinate,
|
|
331
|
+
});
|
|
332
|
+
}
|
|
275
333
|
async function double_click_by(tabId, xpath, highlightIndex) {
|
|
276
334
|
return await chrome.tabs.sendMessage(tabId, {
|
|
277
335
|
type: 'computer:double_click',
|
|
@@ -293,6 +351,14 @@ async function screenshot(windowId) {
|
|
|
293
351
|
},
|
|
294
352
|
};
|
|
295
353
|
}
|
|
354
|
+
async function scroll_to(tabId, coordinate) {
|
|
355
|
+
let from_coordinate = (await cursor_position(tabId)).coordinate;
|
|
356
|
+
return await chrome.tabs.sendMessage(tabId, {
|
|
357
|
+
type: 'computer:scroll_to',
|
|
358
|
+
from_coordinate,
|
|
359
|
+
to_coordinate: coordinate,
|
|
360
|
+
});
|
|
361
|
+
}
|
|
296
362
|
async function scroll_to_by(tabId, xpath, highlightIndex) {
|
|
297
363
|
return await chrome.tabs.sendMessage(tabId, {
|
|
298
364
|
type: 'computer:scroll_to',
|
|
@@ -321,6 +387,31 @@ async function cursor_position(tabId) {
|
|
|
321
387
|
});
|
|
322
388
|
return { coordinate: result.coordinate };
|
|
323
389
|
}
|
|
390
|
+
async function size(tabId) {
|
|
391
|
+
return await getPageSize(tabId);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
var browser = /*#__PURE__*/Object.freeze({
|
|
395
|
+
__proto__: null,
|
|
396
|
+
clear_input: clear_input,
|
|
397
|
+
clear_input_by: clear_input_by,
|
|
398
|
+
cursor_position: cursor_position,
|
|
399
|
+
double_click: double_click,
|
|
400
|
+
double_click_by: double_click_by,
|
|
401
|
+
get_dropdown_options: get_dropdown_options,
|
|
402
|
+
left_click: left_click,
|
|
403
|
+
left_click_by: left_click_by,
|
|
404
|
+
mouse_move: mouse_move,
|
|
405
|
+
right_click: right_click,
|
|
406
|
+
right_click_by: right_click_by,
|
|
407
|
+
screenshot: screenshot,
|
|
408
|
+
scroll_to: scroll_to,
|
|
409
|
+
scroll_to_by: scroll_to_by,
|
|
410
|
+
select_dropdown_option: select_dropdown_option,
|
|
411
|
+
size: size,
|
|
412
|
+
type: type,
|
|
413
|
+
type_by: type_by
|
|
414
|
+
});
|
|
324
415
|
|
|
325
416
|
/**
|
|
326
417
|
* Browser Use for general
|
|
@@ -1582,7 +1673,7 @@ async function getLLMConfig(name = 'llmConfig') {
|
|
|
1582
1673
|
let result = await chrome.storage.sync.get([name]);
|
|
1583
1674
|
return result[name];
|
|
1584
1675
|
}
|
|
1585
|
-
function
|
|
1676
|
+
function loadTools() {
|
|
1586
1677
|
let toolsMap = new Map();
|
|
1587
1678
|
for (const key in tools) {
|
|
1588
1679
|
let tool = tools[key];
|
|
@@ -1599,4 +1690,4 @@ function getAllTools() {
|
|
|
1599
1690
|
return toolsMap;
|
|
1600
1691
|
}
|
|
1601
1692
|
|
|
1602
|
-
export {
|
|
1693
|
+
export { browser, getLLMConfig, loadTools, pub, tools, utils };
|
package/dist/index.cjs.js
CHANGED
|
@@ -3289,6 +3289,19 @@ class ClaudeProvider {
|
|
|
3289
3289
|
if (defaultModel) {
|
|
3290
3290
|
this.defaultModel = defaultModel;
|
|
3291
3291
|
}
|
|
3292
|
+
if (typeof window !== 'undefined' &&
|
|
3293
|
+
typeof document !== 'undefined' &&
|
|
3294
|
+
(typeof param == 'string' || param.apiKey)) {
|
|
3295
|
+
console.warn(`
|
|
3296
|
+
⚠️ Security Warning:
|
|
3297
|
+
DO NOT use API Keys in browser/frontend code!
|
|
3298
|
+
This will expose your credentials and may lead to unauthorized usage.
|
|
3299
|
+
|
|
3300
|
+
Best Practices: Configure backend API proxy request through baseURL and request headers.
|
|
3301
|
+
|
|
3302
|
+
Please refer to the link: https://eko.fellou.ai/docs/getting-started/configuration#web-environment
|
|
3303
|
+
`);
|
|
3304
|
+
}
|
|
3292
3305
|
if (typeof param == 'string') {
|
|
3293
3306
|
this.client = new Anthropic({
|
|
3294
3307
|
apiKey: param,
|
|
@@ -8696,6 +8709,19 @@ class OpenaiProvider {
|
|
|
8696
8709
|
if (defaultModel) {
|
|
8697
8710
|
this.defaultModel = defaultModel;
|
|
8698
8711
|
}
|
|
8712
|
+
if (typeof window !== 'undefined' &&
|
|
8713
|
+
typeof document !== 'undefined' &&
|
|
8714
|
+
(typeof param == 'string' || param.apiKey)) {
|
|
8715
|
+
console.warn(`
|
|
8716
|
+
⚠️ Security Warning:
|
|
8717
|
+
DO NOT use API Keys in browser/frontend code!
|
|
8718
|
+
This will expose your credentials and may lead to unauthorized usage.
|
|
8719
|
+
|
|
8720
|
+
Best Practices: Configure backend API proxy request through baseURL and request headers.
|
|
8721
|
+
|
|
8722
|
+
Please refer to the link: https://eko.fellou.ai/docs/getting-started/configuration#web-environment
|
|
8723
|
+
`);
|
|
8724
|
+
}
|
|
8699
8725
|
if (typeof param == 'string') {
|
|
8700
8726
|
this.client = new OpenAI({
|
|
8701
8727
|
apiKey: param,
|
|
@@ -9086,7 +9112,7 @@ class Eko {
|
|
|
9086
9112
|
}
|
|
9087
9113
|
Eko.tools.forEach((tool) => this.toolRegistry.registerTool(tool));
|
|
9088
9114
|
}
|
|
9089
|
-
async
|
|
9115
|
+
async generate(prompt, param) {
|
|
9090
9116
|
let toolRegistry = this.toolRegistry;
|
|
9091
9117
|
if (param && param.tools && param.tools.length > 0) {
|
|
9092
9118
|
toolRegistry = new ToolRegistry();
|
|
@@ -9103,7 +9129,7 @@ class Eko {
|
|
|
9103
9129
|
const generator = new WorkflowGenerator(this.llmProvider, toolRegistry);
|
|
9104
9130
|
return await generator.generateWorkflow(prompt);
|
|
9105
9131
|
}
|
|
9106
|
-
async
|
|
9132
|
+
async execute(workflow, callback) {
|
|
9107
9133
|
return await workflow.execute(callback);
|
|
9108
9134
|
}
|
|
9109
9135
|
getTool(toolName) {
|
package/dist/index.esm.js
CHANGED
|
@@ -3285,6 +3285,19 @@ class ClaudeProvider {
|
|
|
3285
3285
|
if (defaultModel) {
|
|
3286
3286
|
this.defaultModel = defaultModel;
|
|
3287
3287
|
}
|
|
3288
|
+
if (typeof window !== 'undefined' &&
|
|
3289
|
+
typeof document !== 'undefined' &&
|
|
3290
|
+
(typeof param == 'string' || param.apiKey)) {
|
|
3291
|
+
console.warn(`
|
|
3292
|
+
⚠️ Security Warning:
|
|
3293
|
+
DO NOT use API Keys in browser/frontend code!
|
|
3294
|
+
This will expose your credentials and may lead to unauthorized usage.
|
|
3295
|
+
|
|
3296
|
+
Best Practices: Configure backend API proxy request through baseURL and request headers.
|
|
3297
|
+
|
|
3298
|
+
Please refer to the link: https://eko.fellou.ai/docs/getting-started/configuration#web-environment
|
|
3299
|
+
`);
|
|
3300
|
+
}
|
|
3288
3301
|
if (typeof param == 'string') {
|
|
3289
3302
|
this.client = new Anthropic({
|
|
3290
3303
|
apiKey: param,
|
|
@@ -8692,6 +8705,19 @@ class OpenaiProvider {
|
|
|
8692
8705
|
if (defaultModel) {
|
|
8693
8706
|
this.defaultModel = defaultModel;
|
|
8694
8707
|
}
|
|
8708
|
+
if (typeof window !== 'undefined' &&
|
|
8709
|
+
typeof document !== 'undefined' &&
|
|
8710
|
+
(typeof param == 'string' || param.apiKey)) {
|
|
8711
|
+
console.warn(`
|
|
8712
|
+
⚠️ Security Warning:
|
|
8713
|
+
DO NOT use API Keys in browser/frontend code!
|
|
8714
|
+
This will expose your credentials and may lead to unauthorized usage.
|
|
8715
|
+
|
|
8716
|
+
Best Practices: Configure backend API proxy request through baseURL and request headers.
|
|
8717
|
+
|
|
8718
|
+
Please refer to the link: https://eko.fellou.ai/docs/getting-started/configuration#web-environment
|
|
8719
|
+
`);
|
|
8720
|
+
}
|
|
8695
8721
|
if (typeof param == 'string') {
|
|
8696
8722
|
this.client = new OpenAI({
|
|
8697
8723
|
apiKey: param,
|
|
@@ -9082,7 +9108,7 @@ class Eko {
|
|
|
9082
9108
|
}
|
|
9083
9109
|
Eko.tools.forEach((tool) => this.toolRegistry.registerTool(tool));
|
|
9084
9110
|
}
|
|
9085
|
-
async
|
|
9111
|
+
async generate(prompt, param) {
|
|
9086
9112
|
let toolRegistry = this.toolRegistry;
|
|
9087
9113
|
if (param && param.tools && param.tools.length > 0) {
|
|
9088
9114
|
toolRegistry = new ToolRegistry();
|
|
@@ -9099,7 +9125,7 @@ class Eko {
|
|
|
9099
9125
|
const generator = new WorkflowGenerator(this.llmProvider, toolRegistry);
|
|
9100
9126
|
return await generator.generateWorkflow(prompt);
|
|
9101
9127
|
}
|
|
9102
|
-
async
|
|
9128
|
+
async execute(workflow, callback) {
|
|
9103
9129
|
return await workflow.execute(callback);
|
|
9104
9130
|
}
|
|
9105
9131
|
getTool(toolName) {
|
package/dist/nodejs/core.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Tool } from '../types';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function loadTools(): Map<string, Tool<any, any>>;
|
package/dist/nodejs.cjs.js
CHANGED
|
@@ -210,7 +210,7 @@ var tools = /*#__PURE__*/Object.freeze({
|
|
|
210
210
|
FileWrite: FileWrite
|
|
211
211
|
});
|
|
212
212
|
|
|
213
|
-
function
|
|
213
|
+
function loadTools() {
|
|
214
214
|
let toolsMap = new Map();
|
|
215
215
|
for (const key in tools) {
|
|
216
216
|
let tool = tools[key];
|
|
@@ -227,5 +227,5 @@ function getAllTools() {
|
|
|
227
227
|
return toolsMap;
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
exports.
|
|
230
|
+
exports.loadTools = loadTools;
|
|
231
231
|
exports.tools = tools;
|
package/dist/nodejs.esm.js
CHANGED
|
@@ -208,7 +208,7 @@ var tools = /*#__PURE__*/Object.freeze({
|
|
|
208
208
|
FileWrite: FileWrite
|
|
209
209
|
});
|
|
210
210
|
|
|
211
|
-
function
|
|
211
|
+
function loadTools() {
|
|
212
212
|
let toolsMap = new Map();
|
|
213
213
|
for (const key in tools) {
|
|
214
214
|
let tool = tools[key];
|
|
@@ -225,4 +225,4 @@ function getAllTools() {
|
|
|
225
225
|
return toolsMap;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
export {
|
|
228
|
+
export { loadTools, tools };
|
package/dist/web/core.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Tool } from '../types';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function loadTools(): Map<string, Tool<any, any>>;
|
package/dist/web/index.d.ts
CHANGED
package/dist/web.cjs.js
CHANGED
|
@@ -8627,6 +8627,21 @@ function simulateMouseEvent(eventTypes, button, xpath, highlightIndex) {
|
|
|
8627
8627
|
return true;
|
|
8628
8628
|
}
|
|
8629
8629
|
|
|
8630
|
+
var browser = /*#__PURE__*/Object.freeze({
|
|
8631
|
+
__proto__: null,
|
|
8632
|
+
clear_input: clear_input,
|
|
8633
|
+
double_click: double_click,
|
|
8634
|
+
extractHtmlContent: extractHtmlContent,
|
|
8635
|
+
get_dropdown_options: get_dropdown_options,
|
|
8636
|
+
left_click: left_click,
|
|
8637
|
+
right_click: right_click,
|
|
8638
|
+
screenshot: screenshot,
|
|
8639
|
+
scroll_to: scroll_to,
|
|
8640
|
+
select_dropdown_option: select_dropdown_option,
|
|
8641
|
+
size: size,
|
|
8642
|
+
type: type
|
|
8643
|
+
});
|
|
8644
|
+
|
|
8630
8645
|
/**
|
|
8631
8646
|
* Browser Use for general
|
|
8632
8647
|
*/
|
|
@@ -9360,7 +9375,7 @@ var tools = /*#__PURE__*/Object.freeze({
|
|
|
9360
9375
|
Screenshot: Screenshot
|
|
9361
9376
|
});
|
|
9362
9377
|
|
|
9363
|
-
function
|
|
9378
|
+
function loadTools() {
|
|
9364
9379
|
let toolsMap = new Map();
|
|
9365
9380
|
for (const key in tools) {
|
|
9366
9381
|
let tool = tools[key];
|
|
@@ -9377,5 +9392,6 @@ function getAllTools() {
|
|
|
9377
9392
|
return toolsMap;
|
|
9378
9393
|
}
|
|
9379
9394
|
|
|
9380
|
-
exports.
|
|
9395
|
+
exports.browser = browser;
|
|
9396
|
+
exports.loadTools = loadTools;
|
|
9381
9397
|
exports.tools = tools;
|
package/dist/web.esm.js
CHANGED
|
@@ -8625,6 +8625,21 @@ function simulateMouseEvent(eventTypes, button, xpath, highlightIndex) {
|
|
|
8625
8625
|
return true;
|
|
8626
8626
|
}
|
|
8627
8627
|
|
|
8628
|
+
var browser = /*#__PURE__*/Object.freeze({
|
|
8629
|
+
__proto__: null,
|
|
8630
|
+
clear_input: clear_input,
|
|
8631
|
+
double_click: double_click,
|
|
8632
|
+
extractHtmlContent: extractHtmlContent,
|
|
8633
|
+
get_dropdown_options: get_dropdown_options,
|
|
8634
|
+
left_click: left_click,
|
|
8635
|
+
right_click: right_click,
|
|
8636
|
+
screenshot: screenshot,
|
|
8637
|
+
scroll_to: scroll_to,
|
|
8638
|
+
select_dropdown_option: select_dropdown_option,
|
|
8639
|
+
size: size,
|
|
8640
|
+
type: type
|
|
8641
|
+
});
|
|
8642
|
+
|
|
8628
8643
|
/**
|
|
8629
8644
|
* Browser Use for general
|
|
8630
8645
|
*/
|
|
@@ -9358,7 +9373,7 @@ var tools = /*#__PURE__*/Object.freeze({
|
|
|
9358
9373
|
Screenshot: Screenshot
|
|
9359
9374
|
});
|
|
9360
9375
|
|
|
9361
|
-
function
|
|
9376
|
+
function loadTools() {
|
|
9362
9377
|
let toolsMap = new Map();
|
|
9363
9378
|
for (const key in tools) {
|
|
9364
9379
|
let tool = tools[key];
|
|
@@ -9375,4 +9390,4 @@ function getAllTools() {
|
|
|
9375
9390
|
return toolsMap;
|
|
9376
9391
|
}
|
|
9377
9392
|
|
|
9378
|
-
export {
|
|
9393
|
+
export { browser, loadTools, tools };
|