@eko-ai/eko 1.1.4 → 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 +38 -3
- package/dist/index.esm.js +38 -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
|
@@ -9943,12 +9943,17 @@ class ActionImpl {
|
|
|
9943
9943
|
const existingTabs = await context.ekoConfig.chromeProxy.tabs.query({
|
|
9944
9944
|
windowId: currentWindow.id,
|
|
9945
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
|
+
}
|
|
9946
9951
|
// Prepare initial messages
|
|
9947
9952
|
const messages = [
|
|
9948
9953
|
{ role: 'system', content: this.formatSystemPrompt() },
|
|
9949
9954
|
{
|
|
9950
9955
|
role: 'user',
|
|
9951
|
-
content: this.formatUserPrompt(this.name, this.description, this.tabs, existingTabs),
|
|
9956
|
+
content: this.formatUserPrompt(this.name, this.description, this.tabs, existingTabs, patchs),
|
|
9952
9957
|
},
|
|
9953
9958
|
];
|
|
9954
9959
|
this.logger.logActionStart(this.name, input, context);
|
|
@@ -10121,7 +10126,7 @@ Navigation Bar or Menu Changes: After logging in, the navigation bar will includ
|
|
|
10121
10126
|
- DO NOT REFUSE TO PERFORM THE MISSION
|
|
10122
10127
|
`;
|
|
10123
10128
|
}
|
|
10124
|
-
formatUserPrompt(name, description, mentionedTabs, existingTabs) {
|
|
10129
|
+
formatUserPrompt(name, description, mentionedTabs, existingTabs, patchItems) {
|
|
10125
10130
|
let prompt = `${name} -- The steps you can follow are ${description}`;
|
|
10126
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.`;
|
|
10127
10132
|
if (existingTabs.length > 0) {
|
|
@@ -10134,8 +10139,37 @@ Navigation Bar or Menu Changes: After logging in, the navigation bar will includ
|
|
|
10134
10139
|
'\n\nYou should consider the following tabs firstly:\n' +
|
|
10135
10140
|
mentionedTabs.map((tab) => `- TabID=${tab.id}: ${tab.title} (${tab.url})`).join('\n');
|
|
10136
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
|
+
}
|
|
10137
10147
|
return prompt;
|
|
10138
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
|
+
}
|
|
10139
10173
|
// Static factory method
|
|
10140
10174
|
static createPromptAction(name, description, tools, llmProvider, llmConfig) {
|
|
10141
10175
|
return new ActionImpl('prompt', name, description, tools, llmProvider, llmConfig);
|
|
@@ -10520,7 +10554,7 @@ class Eko {
|
|
|
10520
10554
|
this.prompt = "";
|
|
10521
10555
|
this.tabs = [];
|
|
10522
10556
|
this.workflow = undefined;
|
|
10523
|
-
console.info("using Eko@" + "
|
|
10557
|
+
console.info("using Eko@" + "ffed3dcfde4a8b89072e1c33ad98532f7522fe47");
|
|
10524
10558
|
console.warn("this version is POC, should not used for production");
|
|
10525
10559
|
this.llmProvider = LLMProviderFactory.buildLLMProvider(llmConfig);
|
|
10526
10560
|
this.ekoConfig = this.buildEkoConfig(ekoConfig);
|
|
@@ -10534,6 +10568,7 @@ class Eko {
|
|
|
10534
10568
|
workingWindowId: undefined,
|
|
10535
10569
|
chromeProxy: typeof chrome === 'undefined' ? undefined : chrome,
|
|
10536
10570
|
callback: undefined,
|
|
10571
|
+
patchServerUrl: "http://127.0.0.1:8000/eko",
|
|
10537
10572
|
};
|
|
10538
10573
|
return {
|
|
10539
10574
|
...defaultEkoConfig,
|
package/dist/index.esm.js
CHANGED
|
@@ -9939,12 +9939,17 @@ class ActionImpl {
|
|
|
9939
9939
|
const existingTabs = await context.ekoConfig.chromeProxy.tabs.query({
|
|
9940
9940
|
windowId: currentWindow.id,
|
|
9941
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
|
+
}
|
|
9942
9947
|
// Prepare initial messages
|
|
9943
9948
|
const messages = [
|
|
9944
9949
|
{ role: 'system', content: this.formatSystemPrompt() },
|
|
9945
9950
|
{
|
|
9946
9951
|
role: 'user',
|
|
9947
|
-
content: this.formatUserPrompt(this.name, this.description, this.tabs, existingTabs),
|
|
9952
|
+
content: this.formatUserPrompt(this.name, this.description, this.tabs, existingTabs, patchs),
|
|
9948
9953
|
},
|
|
9949
9954
|
];
|
|
9950
9955
|
this.logger.logActionStart(this.name, input, context);
|
|
@@ -10117,7 +10122,7 @@ Navigation Bar or Menu Changes: After logging in, the navigation bar will includ
|
|
|
10117
10122
|
- DO NOT REFUSE TO PERFORM THE MISSION
|
|
10118
10123
|
`;
|
|
10119
10124
|
}
|
|
10120
|
-
formatUserPrompt(name, description, mentionedTabs, existingTabs) {
|
|
10125
|
+
formatUserPrompt(name, description, mentionedTabs, existingTabs, patchItems) {
|
|
10121
10126
|
let prompt = `${name} -- The steps you can follow are ${description}`;
|
|
10122
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.`;
|
|
10123
10128
|
if (existingTabs.length > 0) {
|
|
@@ -10130,8 +10135,37 @@ Navigation Bar or Menu Changes: After logging in, the navigation bar will includ
|
|
|
10130
10135
|
'\n\nYou should consider the following tabs firstly:\n' +
|
|
10131
10136
|
mentionedTabs.map((tab) => `- TabID=${tab.id}: ${tab.title} (${tab.url})`).join('\n');
|
|
10132
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
|
+
}
|
|
10133
10143
|
return prompt;
|
|
10134
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
|
+
}
|
|
10135
10169
|
// Static factory method
|
|
10136
10170
|
static createPromptAction(name, description, tools, llmProvider, llmConfig) {
|
|
10137
10171
|
return new ActionImpl('prompt', name, description, tools, llmProvider, llmConfig);
|
|
@@ -10516,7 +10550,7 @@ class Eko {
|
|
|
10516
10550
|
this.prompt = "";
|
|
10517
10551
|
this.tabs = [];
|
|
10518
10552
|
this.workflow = undefined;
|
|
10519
|
-
console.info("using Eko@" + "
|
|
10553
|
+
console.info("using Eko@" + "ffed3dcfde4a8b89072e1c33ad98532f7522fe47");
|
|
10520
10554
|
console.warn("this version is POC, should not used for production");
|
|
10521
10555
|
this.llmProvider = LLMProviderFactory.buildLLMProvider(llmConfig);
|
|
10522
10556
|
this.ekoConfig = this.buildEkoConfig(ekoConfig);
|
|
@@ -10530,6 +10564,7 @@ class Eko {
|
|
|
10530
10564
|
workingWindowId: undefined,
|
|
10531
10565
|
chromeProxy: typeof chrome === 'undefined' ? undefined : chrome,
|
|
10532
10566
|
callback: undefined,
|
|
10567
|
+
patchServerUrl: "http://127.0.0.1:8000/eko",
|
|
10533
10568
|
};
|
|
10534
10569
|
return {
|
|
10535
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;
|