@eko-ai/eko 1.1.3 → 1.2.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/dist/index.cjs.js +39 -3
- package/dist/index.esm.js +39 -3
- package/dist/models/action.d.ts +1 -0
- package/dist/types/action.types.d.ts +4 -0
- package/dist/types/eko.types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -8956,6 +8956,7 @@ class OpenaiProvider {
|
|
|
8956
8956
|
}
|
|
8957
8957
|
return {
|
|
8958
8958
|
stream: stream,
|
|
8959
|
+
stream_options: stream ? { include_usage: true } : undefined,
|
|
8959
8960
|
model: params.model || this.defaultModel,
|
|
8960
8961
|
max_tokens: params.maxTokens || 4096,
|
|
8961
8962
|
temperature: params.temperature,
|
|
@@ -9942,12 +9943,17 @@ class ActionImpl {
|
|
|
9942
9943
|
const existingTabs = await context.ekoConfig.chromeProxy.tabs.query({
|
|
9943
9944
|
windowId: currentWindow.id,
|
|
9944
9945
|
});
|
|
9946
|
+
// get patchs for task
|
|
9947
|
+
let patchs = [];
|
|
9948
|
+
if (context.ekoConfig.patchServerUrl) {
|
|
9949
|
+
patchs = await this.getPatchs(this.name, context.ekoConfig.patchServerUrl);
|
|
9950
|
+
}
|
|
9945
9951
|
// Prepare initial messages
|
|
9946
9952
|
const messages = [
|
|
9947
9953
|
{ role: 'system', content: this.formatSystemPrompt() },
|
|
9948
9954
|
{
|
|
9949
9955
|
role: 'user',
|
|
9950
|
-
content: this.formatUserPrompt(this.name, this.description, this.tabs, existingTabs),
|
|
9956
|
+
content: this.formatUserPrompt(this.name, this.description, this.tabs, existingTabs, patchs),
|
|
9951
9957
|
},
|
|
9952
9958
|
];
|
|
9953
9959
|
this.logger.logActionStart(this.name, input, context);
|
|
@@ -10120,7 +10126,7 @@ Navigation Bar or Menu Changes: After logging in, the navigation bar will includ
|
|
|
10120
10126
|
- DO NOT REFUSE TO PERFORM THE MISSION
|
|
10121
10127
|
`;
|
|
10122
10128
|
}
|
|
10123
|
-
formatUserPrompt(name, description, mentionedTabs, existingTabs) {
|
|
10129
|
+
formatUserPrompt(name, description, mentionedTabs, existingTabs, patchItems) {
|
|
10124
10130
|
let prompt = `${name} -- The steps you can follow are ${description}`;
|
|
10125
10131
|
prompt = `Your ultimate task is: """${prompt}""". If you achieved your ultimate task, stop everything and use the done action in the next step to complete the task. If not, continue as usual.`;
|
|
10126
10132
|
if (existingTabs.length > 0) {
|
|
@@ -10133,8 +10139,37 @@ Navigation Bar or Menu Changes: After logging in, the navigation bar will includ
|
|
|
10133
10139
|
'\n\nYou should consider the following tabs firstly:\n' +
|
|
10134
10140
|
mentionedTabs.map((tab) => `- TabID=${tab.id}: ${tab.title} (${tab.url})`).join('\n');
|
|
10135
10141
|
}
|
|
10142
|
+
if (patchItems.length > 0) {
|
|
10143
|
+
prompt +=
|
|
10144
|
+
'\n\You can refer to the following cases and tips:\n' +
|
|
10145
|
+
patchItems.map((item) => `<task>${item.task}</task><tips>${item.patch}</tips>`).join('\n');
|
|
10146
|
+
}
|
|
10136
10147
|
return prompt;
|
|
10137
10148
|
}
|
|
10149
|
+
async getPatchs(task, patchServerUrl) {
|
|
10150
|
+
const form = {
|
|
10151
|
+
task,
|
|
10152
|
+
top_k: 3,
|
|
10153
|
+
};
|
|
10154
|
+
try {
|
|
10155
|
+
const response = await fetch(`${patchServerUrl}/search`, {
|
|
10156
|
+
method: 'POST',
|
|
10157
|
+
headers: {
|
|
10158
|
+
'Content-Type': 'application/json',
|
|
10159
|
+
},
|
|
10160
|
+
body: JSON.stringify(form),
|
|
10161
|
+
});
|
|
10162
|
+
if (!response.ok) {
|
|
10163
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
10164
|
+
}
|
|
10165
|
+
const data = await response.json();
|
|
10166
|
+
return data.map((entryWithScore) => entryWithScore.entry);
|
|
10167
|
+
}
|
|
10168
|
+
catch (error) {
|
|
10169
|
+
console.error('Failed to fetch patches:', error);
|
|
10170
|
+
return [];
|
|
10171
|
+
}
|
|
10172
|
+
}
|
|
10138
10173
|
// Static factory method
|
|
10139
10174
|
static createPromptAction(name, description, tools, llmProvider, llmConfig) {
|
|
10140
10175
|
return new ActionImpl('prompt', name, description, tools, llmProvider, llmConfig);
|
|
@@ -10519,7 +10554,7 @@ class Eko {
|
|
|
10519
10554
|
this.prompt = "";
|
|
10520
10555
|
this.tabs = [];
|
|
10521
10556
|
this.workflow = undefined;
|
|
10522
|
-
console.info("using Eko@" + "
|
|
10557
|
+
console.info("using Eko@" + "ffed3dcfde4a8b89072e1c33ad98532f7522fe47");
|
|
10523
10558
|
console.warn("this version is POC, should not used for production");
|
|
10524
10559
|
this.llmProvider = LLMProviderFactory.buildLLMProvider(llmConfig);
|
|
10525
10560
|
this.ekoConfig = this.buildEkoConfig(ekoConfig);
|
|
@@ -10533,6 +10568,7 @@ class Eko {
|
|
|
10533
10568
|
workingWindowId: undefined,
|
|
10534
10569
|
chromeProxy: typeof chrome === 'undefined' ? undefined : chrome,
|
|
10535
10570
|
callback: undefined,
|
|
10571
|
+
patchServerUrl: "http://127.0.0.1:8000/eko",
|
|
10536
10572
|
};
|
|
10537
10573
|
return {
|
|
10538
10574
|
...defaultEkoConfig,
|
package/dist/index.esm.js
CHANGED
|
@@ -8952,6 +8952,7 @@ class OpenaiProvider {
|
|
|
8952
8952
|
}
|
|
8953
8953
|
return {
|
|
8954
8954
|
stream: stream,
|
|
8955
|
+
stream_options: stream ? { include_usage: true } : undefined,
|
|
8955
8956
|
model: params.model || this.defaultModel,
|
|
8956
8957
|
max_tokens: params.maxTokens || 4096,
|
|
8957
8958
|
temperature: params.temperature,
|
|
@@ -9938,12 +9939,17 @@ class ActionImpl {
|
|
|
9938
9939
|
const existingTabs = await context.ekoConfig.chromeProxy.tabs.query({
|
|
9939
9940
|
windowId: currentWindow.id,
|
|
9940
9941
|
});
|
|
9942
|
+
// get patchs for task
|
|
9943
|
+
let patchs = [];
|
|
9944
|
+
if (context.ekoConfig.patchServerUrl) {
|
|
9945
|
+
patchs = await this.getPatchs(this.name, context.ekoConfig.patchServerUrl);
|
|
9946
|
+
}
|
|
9941
9947
|
// Prepare initial messages
|
|
9942
9948
|
const messages = [
|
|
9943
9949
|
{ role: 'system', content: this.formatSystemPrompt() },
|
|
9944
9950
|
{
|
|
9945
9951
|
role: 'user',
|
|
9946
|
-
content: this.formatUserPrompt(this.name, this.description, this.tabs, existingTabs),
|
|
9952
|
+
content: this.formatUserPrompt(this.name, this.description, this.tabs, existingTabs, patchs),
|
|
9947
9953
|
},
|
|
9948
9954
|
];
|
|
9949
9955
|
this.logger.logActionStart(this.name, input, context);
|
|
@@ -10116,7 +10122,7 @@ Navigation Bar or Menu Changes: After logging in, the navigation bar will includ
|
|
|
10116
10122
|
- DO NOT REFUSE TO PERFORM THE MISSION
|
|
10117
10123
|
`;
|
|
10118
10124
|
}
|
|
10119
|
-
formatUserPrompt(name, description, mentionedTabs, existingTabs) {
|
|
10125
|
+
formatUserPrompt(name, description, mentionedTabs, existingTabs, patchItems) {
|
|
10120
10126
|
let prompt = `${name} -- The steps you can follow are ${description}`;
|
|
10121
10127
|
prompt = `Your ultimate task is: """${prompt}""". If you achieved your ultimate task, stop everything and use the done action in the next step to complete the task. If not, continue as usual.`;
|
|
10122
10128
|
if (existingTabs.length > 0) {
|
|
@@ -10129,8 +10135,37 @@ Navigation Bar or Menu Changes: After logging in, the navigation bar will includ
|
|
|
10129
10135
|
'\n\nYou should consider the following tabs firstly:\n' +
|
|
10130
10136
|
mentionedTabs.map((tab) => `- TabID=${tab.id}: ${tab.title} (${tab.url})`).join('\n');
|
|
10131
10137
|
}
|
|
10138
|
+
if (patchItems.length > 0) {
|
|
10139
|
+
prompt +=
|
|
10140
|
+
'\n\You can refer to the following cases and tips:\n' +
|
|
10141
|
+
patchItems.map((item) => `<task>${item.task}</task><tips>${item.patch}</tips>`).join('\n');
|
|
10142
|
+
}
|
|
10132
10143
|
return prompt;
|
|
10133
10144
|
}
|
|
10145
|
+
async getPatchs(task, patchServerUrl) {
|
|
10146
|
+
const form = {
|
|
10147
|
+
task,
|
|
10148
|
+
top_k: 3,
|
|
10149
|
+
};
|
|
10150
|
+
try {
|
|
10151
|
+
const response = await fetch(`${patchServerUrl}/search`, {
|
|
10152
|
+
method: 'POST',
|
|
10153
|
+
headers: {
|
|
10154
|
+
'Content-Type': 'application/json',
|
|
10155
|
+
},
|
|
10156
|
+
body: JSON.stringify(form),
|
|
10157
|
+
});
|
|
10158
|
+
if (!response.ok) {
|
|
10159
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
10160
|
+
}
|
|
10161
|
+
const data = await response.json();
|
|
10162
|
+
return data.map((entryWithScore) => entryWithScore.entry);
|
|
10163
|
+
}
|
|
10164
|
+
catch (error) {
|
|
10165
|
+
console.error('Failed to fetch patches:', error);
|
|
10166
|
+
return [];
|
|
10167
|
+
}
|
|
10168
|
+
}
|
|
10134
10169
|
// Static factory method
|
|
10135
10170
|
static createPromptAction(name, description, tools, llmProvider, llmConfig) {
|
|
10136
10171
|
return new ActionImpl('prompt', name, description, tools, llmProvider, llmConfig);
|
|
@@ -10515,7 +10550,7 @@ class Eko {
|
|
|
10515
10550
|
this.prompt = "";
|
|
10516
10551
|
this.tabs = [];
|
|
10517
10552
|
this.workflow = undefined;
|
|
10518
|
-
console.info("using Eko@" + "
|
|
10553
|
+
console.info("using Eko@" + "ffed3dcfde4a8b89072e1c33ad98532f7522fe47");
|
|
10519
10554
|
console.warn("this version is POC, should not used for production");
|
|
10520
10555
|
this.llmProvider = LLMProviderFactory.buildLLMProvider(llmConfig);
|
|
10521
10556
|
this.ekoConfig = this.buildEkoConfig(ekoConfig);
|
|
@@ -10529,6 +10564,7 @@ class Eko {
|
|
|
10529
10564
|
workingWindowId: undefined,
|
|
10530
10565
|
chromeProxy: typeof chrome === 'undefined' ? undefined : chrome,
|
|
10531
10566
|
callback: undefined,
|
|
10567
|
+
patchServerUrl: "http://127.0.0.1:8000/eko",
|
|
10532
10568
|
};
|
|
10533
10569
|
return {
|
|
10534
10570
|
...defaultEkoConfig,
|
package/dist/models/action.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare class ActionImpl implements Action {
|
|
|
26
26
|
}>;
|
|
27
27
|
private formatSystemPrompt;
|
|
28
28
|
private formatUserPrompt;
|
|
29
|
+
private getPatchs;
|
|
29
30
|
static createPromptAction(name: string, description: string, tools: Tool<any, any>[], llmProvider: LLMProvider | undefined, llmConfig?: LLMParameters): Action;
|
|
30
31
|
private wrapToolInputSchema;
|
|
31
32
|
private unwrapToolCall;
|