@jarvis-agent/core 0.2.5 → 0.3.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/agent/base.d.ts.map +1 -1
- package/dist/chat/chat-agent.d.ts.map +1 -1
- package/dist/chat/index.d.ts +2 -1
- package/dist/chat/index.d.ts.map +1 -1
- package/dist/chat/tools/activate-skill-tool.d.ts +20 -0
- package/dist/chat/tools/activate-skill-tool.d.ts.map +1 -0
- package/dist/index.cjs +145 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +145 -30
- package/dist/index.esm.js.map +1 -1
- package/dist/prompt/agent.d.ts.map +1 -1
- package/dist/prompt/chat.d.ts +1 -1
- package/dist/prompt/chat.d.ts.map +1 -1
- package/dist/types/config.types.d.ts +2 -0
- package/dist/types/config.types.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/skill.types.d.ts +36 -0
- package/dist/types/skill.types.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import TaskContext, { AgentContext } from "./agent/agent-context";
|
|
|
10
10
|
import { RetryLanguageModel, callLLM, callWithReAct } from "./llm";
|
|
11
11
|
export default Eko;
|
|
12
12
|
export { Eko, EkoMemory, Log, config, global, Chain, Planner, AgentChain, TaskContext, AgentContext, SimpleSseMcpClient, SimpleHttpMcpClient, RetryLanguageModel, TaskContext as Context, callLLM, callWithReAct, };
|
|
13
|
-
export { ChatAgent, ChatContext, AgentWrapTool, WebSearchTool, WebpageQaTool, DeepActionTool, TaskVariableStorageTool, } from "./chat";
|
|
13
|
+
export { ChatAgent, ChatContext, AgentWrapTool, WebSearchTool, WebpageQaTool, DeepActionTool, TaskVariableStorageTool, ActivateSkillTool, } from "./chat";
|
|
14
14
|
export { Agent, type AgentParams, BaseFileAgent, BaseBrowserAgent, BaseBrowserLabelsAgent, BaseBrowserScreenAgent, } from "./agent";
|
|
15
15
|
export { ForeachTaskTool, WatchTriggerTool, HumanInteractTool, TaskNodeStatusTool, VariableStorageTool, } from "./tools";
|
|
16
16
|
export type { ChatService, BrowserService } from "./service";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,GAAG,MAAM,cAAc,CAAC;AAC/B,OAAO,GAAG,MAAM,eAAe,CAAC;AAChC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,WAAW,EAAE,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEnE,eAAe,GAAG,CAAC;AAEnB,OAAO,EACL,GAAG,EACH,SAAS,EACT,GAAG,EACH,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,EACP,UAAU,EACV,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,IAAI,OAAO,EACtB,OAAO,EACP,aAAa,GACd,CAAC;AAEF,OAAO,EACL,SAAS,EACT,WAAW,EACX,aAAa,EACb,aAAa,EACb,aAAa,EACb,cAAc,EACd,uBAAuB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,GAAG,MAAM,cAAc,CAAC;AAC/B,OAAO,GAAG,MAAM,eAAe,CAAC;AAChC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,WAAW,EAAE,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEnE,eAAe,GAAG,CAAC;AAEnB,OAAO,EACL,GAAG,EACH,SAAS,EACT,GAAG,EACH,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,EACP,UAAU,EACV,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,IAAI,OAAO,EACtB,OAAO,EACP,aAAa,GACd,CAAC;AAEF,OAAO,EACL,SAAS,EACT,WAAW,EACX,aAAa,EACb,aAAa,EACb,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,KAAK,EACL,KAAK,WAAW,EAChB,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EACL,GAAG,EACH,MAAM,EACN,MAAM,EACN,OAAO,EACP,OAAO,EACP,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,cAAc,SAAS,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -37021,10 +37021,10 @@ function resetWorkflowXml(workflow) {
|
|
|
37021
37021
|
workflow.xml = xml;
|
|
37022
37022
|
}
|
|
37023
37023
|
|
|
37024
|
-
const TOOL_NAME$
|
|
37024
|
+
const TOOL_NAME$c = "task_snapshot";
|
|
37025
37025
|
class TaskSnapshotTool {
|
|
37026
37026
|
constructor() {
|
|
37027
|
-
this.name = TOOL_NAME$
|
|
37027
|
+
this.name = TOOL_NAME$c;
|
|
37028
37028
|
this.description = `Task snapshot archive, recording key information of the current task, updating task node status, facilitating subsequent continuation of operation.`;
|
|
37029
37029
|
this.parameters = {
|
|
37030
37030
|
type: "object",
|
|
@@ -39593,10 +39593,10 @@ class ToolWrapper {
|
|
|
39593
39593
|
}
|
|
39594
39594
|
}
|
|
39595
39595
|
|
|
39596
|
-
const TOOL_NAME$
|
|
39596
|
+
const TOOL_NAME$b = "foreach_task";
|
|
39597
39597
|
class ForeachTaskTool {
|
|
39598
39598
|
constructor() {
|
|
39599
|
-
this.name = TOOL_NAME$
|
|
39599
|
+
this.name = TOOL_NAME$b;
|
|
39600
39600
|
this.description = `When executing the \`forEach\` node, please use the current tool for counting to ensure tasks are executed sequentially, the tool needs to be called with each loop iteration.`;
|
|
39601
39601
|
this.parameters = {
|
|
39602
39602
|
type: "object",
|
|
@@ -39652,7 +39652,7 @@ class ForeachTaskTool {
|
|
|
39652
39652
|
}
|
|
39653
39653
|
}
|
|
39654
39654
|
|
|
39655
|
-
const TOOL_NAME$
|
|
39655
|
+
const TOOL_NAME$a = "watch_trigger";
|
|
39656
39656
|
const watch_system_prompt = `You are a tool for detecting element changes. Given a task description, compare two images to determine whether the changes described in the task have occurred.
|
|
39657
39657
|
If the changes have occurred, return an json with \`changed\` set to true and \`changeInfo\` containing a description of the changes. If no changes have occurred, return an object with \`changed\` set to false.
|
|
39658
39658
|
|
|
@@ -39671,7 +39671,7 @@ Output:
|
|
|
39671
39671
|
}`;
|
|
39672
39672
|
class WatchTriggerTool {
|
|
39673
39673
|
constructor() {
|
|
39674
|
-
this.name = TOOL_NAME$
|
|
39674
|
+
this.name = TOOL_NAME$a;
|
|
39675
39675
|
this.description = `When executing the \`watch\` node, please use it to monitor DOM element changes, it will block the listener until the element changes or times out.`;
|
|
39676
39676
|
this.parameters = {
|
|
39677
39677
|
type: "object",
|
|
@@ -39860,10 +39860,10 @@ class WatchTriggerTool {
|
|
|
39860
39860
|
}
|
|
39861
39861
|
}
|
|
39862
39862
|
|
|
39863
|
-
const TOOL_NAME$
|
|
39863
|
+
const TOOL_NAME$9 = "human_interact";
|
|
39864
39864
|
class HumanInteractTool {
|
|
39865
39865
|
constructor() {
|
|
39866
|
-
this.name = TOOL_NAME$
|
|
39866
|
+
this.name = TOOL_NAME$9;
|
|
39867
39867
|
this.noPlan = true;
|
|
39868
39868
|
this.description = `AI interacts with humans:
|
|
39869
39869
|
confirm: Ask the user to confirm whether to execute an operation, especially when performing dangerous actions such as deleting system files, users will choose Yes or No.
|
|
@@ -39999,10 +39999,10 @@ request_help: Request assistance from the user; for instance, when an operation
|
|
|
39999
39999
|
}
|
|
40000
40000
|
}
|
|
40001
40001
|
|
|
40002
|
-
const TOOL_NAME$
|
|
40002
|
+
const TOOL_NAME$8 = "task_node_status";
|
|
40003
40003
|
class TaskNodeStatusTool {
|
|
40004
40004
|
constructor() {
|
|
40005
|
-
this.name = TOOL_NAME$
|
|
40005
|
+
this.name = TOOL_NAME$8;
|
|
40006
40006
|
this.description = `After completing each step of the task, you need to call this tool to update the status of the task node, and think about the tasks to be processed and the next action plan.`;
|
|
40007
40007
|
this.parameters = {
|
|
40008
40008
|
type: "object",
|
|
@@ -40054,10 +40054,10 @@ class TaskNodeStatusTool {
|
|
|
40054
40054
|
}
|
|
40055
40055
|
}
|
|
40056
40056
|
|
|
40057
|
-
const TOOL_NAME$
|
|
40057
|
+
const TOOL_NAME$7 = "variable_storage";
|
|
40058
40058
|
class VariableStorageTool {
|
|
40059
40059
|
constructor() {
|
|
40060
|
-
this.name = TOOL_NAME$
|
|
40060
|
+
this.name = TOOL_NAME$7;
|
|
40061
40061
|
this.description = `Used for storing, reading, and retrieving variable data, and maintaining input/output variables in task nodes. When the same variable is stored repeatedly, it will overwrite the previous value.`;
|
|
40062
40062
|
this.parameters = {
|
|
40063
40063
|
type: "object",
|
|
@@ -40142,6 +40142,73 @@ class McpTool {
|
|
|
40142
40142
|
}
|
|
40143
40143
|
}
|
|
40144
40144
|
|
|
40145
|
+
/**
|
|
40146
|
+
* INPUT: global.skillService for skill metadata and content
|
|
40147
|
+
* OUTPUT: Activated skill instructions + resource listing
|
|
40148
|
+
* POSITION: Chat dialogue tool enabling LLM to load domain-specific skills
|
|
40149
|
+
*/
|
|
40150
|
+
const TOOL_NAME$6 = "activate_skill";
|
|
40151
|
+
/** Works as both DialogueTool (Chat) and Tool (Agent) */
|
|
40152
|
+
class ActivateSkillTool {
|
|
40153
|
+
constructor() {
|
|
40154
|
+
this.name = TOOL_NAME$6;
|
|
40155
|
+
this.noPlan = true;
|
|
40156
|
+
}
|
|
40157
|
+
/** Dynamic description with available skill list */
|
|
40158
|
+
get description() {
|
|
40159
|
+
const skills = global.skillService?.getAllMetadata()?.filter((s) => s.enabled) || [];
|
|
40160
|
+
if (skills.length === 0) {
|
|
40161
|
+
return "Activate a specialized skill. No skills currently available.";
|
|
40162
|
+
}
|
|
40163
|
+
const list = skills.map((s) => `- ${s.name}: ${s.description}`).join("\n");
|
|
40164
|
+
return `Activate a specialized skill that provides domain-specific instructions.\n\nAvailable skills:\n${list}`;
|
|
40165
|
+
}
|
|
40166
|
+
/** Dynamic parameters with enum constraint */
|
|
40167
|
+
get parameters() {
|
|
40168
|
+
const skillNames = (global.skillService?.getAllMetadata()?.filter((s) => s.enabled) || []).map((s) => s.name);
|
|
40169
|
+
return {
|
|
40170
|
+
type: "object",
|
|
40171
|
+
properties: {
|
|
40172
|
+
name: {
|
|
40173
|
+
type: "string",
|
|
40174
|
+
...(skillNames.length > 0 ? { enum: skillNames } : {}),
|
|
40175
|
+
description: "Name of the skill to activate",
|
|
40176
|
+
},
|
|
40177
|
+
},
|
|
40178
|
+
required: ["name"],
|
|
40179
|
+
};
|
|
40180
|
+
}
|
|
40181
|
+
async execute(args) {
|
|
40182
|
+
const name = args.name;
|
|
40183
|
+
if (!global.skillService) {
|
|
40184
|
+
return {
|
|
40185
|
+
content: [{ type: "text", text: "Skill service not available" }],
|
|
40186
|
+
isError: true,
|
|
40187
|
+
};
|
|
40188
|
+
}
|
|
40189
|
+
const skill = await global.skillService.loadSkill(name);
|
|
40190
|
+
if (!skill) {
|
|
40191
|
+
return {
|
|
40192
|
+
content: [{ type: "text", text: `Skill "${name}" not found` }],
|
|
40193
|
+
isError: true,
|
|
40194
|
+
};
|
|
40195
|
+
}
|
|
40196
|
+
const output = [
|
|
40197
|
+
`<activated_skill name="${skill.metadata.name}">`,
|
|
40198
|
+
`<instructions>`,
|
|
40199
|
+
skill.instructions.trim(),
|
|
40200
|
+
`</instructions>`,
|
|
40201
|
+
];
|
|
40202
|
+
if (skill.resources.length > 0) {
|
|
40203
|
+
output.push(`<available_resources base="${skill.basePath}">`);
|
|
40204
|
+
skill.resources.forEach((r) => output.push(` <file>${r}</file>`));
|
|
40205
|
+
output.push(`</available_resources>`);
|
|
40206
|
+
}
|
|
40207
|
+
output.push(`</activated_skill>`);
|
|
40208
|
+
return { content: [{ type: "text", text: output.join("\n") }] };
|
|
40209
|
+
}
|
|
40210
|
+
}
|
|
40211
|
+
|
|
40145
40212
|
const TOOL_NAME$5 = "task_result_check";
|
|
40146
40213
|
class TaskResultCheckTool {
|
|
40147
40214
|
constructor() {
|
|
@@ -40384,26 +40451,34 @@ You are {{name}}, an autonomous AI agent for {{agent}} agent.
|
|
|
40384
40451
|
<if extSysPrompt>
|
|
40385
40452
|
{{extSysPrompt}}
|
|
40386
40453
|
</if>
|
|
40387
|
-
<if ${TOOL_NAME$
|
|
40454
|
+
<if ${TOOL_NAME$9}Tool>
|
|
40388
40455
|
* HUMAN INTERACT
|
|
40389
|
-
During the task execution process, you can use the \`${TOOL_NAME$
|
|
40456
|
+
During the task execution process, you can use the \`${TOOL_NAME$9}\` tool to interact with humans, please call it in the following situations:
|
|
40390
40457
|
- When performing dangerous operations such as deleting files, confirmation from humans is required.
|
|
40391
40458
|
- When encountering obstacles while accessing websites, such as requiring user login, captcha verification, QR code scanning, or human verification, you need to request manual assistance.
|
|
40392
|
-
- Please do not use the \`${TOOL_NAME$
|
|
40393
|
-
- The \`${TOOL_NAME$
|
|
40459
|
+
- Please do not use the \`${TOOL_NAME$9}\` tool frequently.
|
|
40460
|
+
- The \`${TOOL_NAME$9}\` tool does not support parallel calls.
|
|
40394
40461
|
</if>
|
|
40395
|
-
<if ${TOOL_NAME$
|
|
40462
|
+
<if ${TOOL_NAME$7}Tool>
|
|
40396
40463
|
* VARIABLE STORAGE
|
|
40397
|
-
When a step node has input/output variable attributes, use the \`${TOOL_NAME$
|
|
40398
|
-
The \`${TOOL_NAME$
|
|
40464
|
+
When a step node has input/output variable attributes, use the \`${TOOL_NAME$7}\` tool to read from and write to these variables, these variables enable context sharing and coordination between multiple agents.
|
|
40465
|
+
The \`${TOOL_NAME$7}\` tool does not support parallel calls.
|
|
40399
40466
|
</if>
|
|
40400
|
-
<if ${TOOL_NAME$
|
|
40467
|
+
<if ${TOOL_NAME$b}Tool>
|
|
40401
40468
|
* forEach node
|
|
40402
|
-
For repetitive tasks, when executing a forEach node, the \`${TOOL_NAME$
|
|
40469
|
+
For repetitive tasks, when executing a forEach node, the \`${TOOL_NAME$b}\` tool must be used. Loop tasks support parallel tool calls, and during parallel execution, this tool needs to be called interspersed throughout the process.
|
|
40403
40470
|
</if>
|
|
40404
|
-
<if ${TOOL_NAME$
|
|
40471
|
+
<if ${TOOL_NAME$a}Tool>
|
|
40405
40472
|
* watch node
|
|
40406
|
-
monitor changes in webpage DOM elements, when executing to the watch node, require the use of the \`${TOOL_NAME$
|
|
40473
|
+
monitor changes in webpage DOM elements, when executing to the watch node, require the use of the \`${TOOL_NAME$a}\` tool.
|
|
40474
|
+
</if>
|
|
40475
|
+
<if ${TOOL_NAME$6}Tool>
|
|
40476
|
+
* SKILLS
|
|
40477
|
+
You can use the \`${TOOL_NAME$6}\` tool to load domain-specific skill instructions when they would help complete the current task.
|
|
40478
|
+
<if skills>
|
|
40479
|
+
Available skills:
|
|
40480
|
+
{{skills}}
|
|
40481
|
+
</if>
|
|
40407
40482
|
</if>
|
|
40408
40483
|
|
|
40409
40484
|
<if mainTask>
|
|
@@ -40457,6 +40532,14 @@ function getAgentSystemPrompt(agent, agentNode, context, tools, extSysPrompt) {
|
|
|
40457
40532
|
for (let i = 0; i < tools.length; i++) {
|
|
40458
40533
|
toolVars[tools[i].name + "Tool"] = true;
|
|
40459
40534
|
}
|
|
40535
|
+
// Inject skill list when available
|
|
40536
|
+
let _skills = "";
|
|
40537
|
+
if (global.skillService) {
|
|
40538
|
+
const skills = global.skillService.getAllMetadata().filter((s) => s.enabled);
|
|
40539
|
+
if (skills.length > 0) {
|
|
40540
|
+
_skills = skills.map((s) => `- ${s.name}: ${s.description}`).join("\n");
|
|
40541
|
+
}
|
|
40542
|
+
}
|
|
40460
40543
|
let mainTask = "";
|
|
40461
40544
|
let preTaskResult = "";
|
|
40462
40545
|
if (context.chain.agents.length > 1) {
|
|
@@ -40469,6 +40552,7 @@ function getAgentSystemPrompt(agent, agentNode, context, tools, extSysPrompt) {
|
|
|
40469
40552
|
agent: agent.Name,
|
|
40470
40553
|
description: agent.Description,
|
|
40471
40554
|
extSysPrompt: extSysPrompt?.trim() || "",
|
|
40555
|
+
skills: _skills,
|
|
40472
40556
|
mainTask: mainTask,
|
|
40473
40557
|
preTaskResult: preTaskResult.trim(),
|
|
40474
40558
|
hasWatchNode: agentNode.xml.indexOf("</watch>") > -1,
|
|
@@ -40489,7 +40573,7 @@ function buildPreTaskResult(context) {
|
|
|
40489
40573
|
return preTaskResult.trim();
|
|
40490
40574
|
}
|
|
40491
40575
|
function getAgentUserPrompt(agent, agentNode, context, tools) {
|
|
40492
|
-
const hasTaskNodeStatusTool = (tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$
|
|
40576
|
+
const hasTaskNodeStatusTool = (tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$8)
|
|
40493
40577
|
.length > 0;
|
|
40494
40578
|
return buildAgentRootXml(agentNode.xml, context.chain.taskPrompt, (nodeId, node) => {
|
|
40495
40579
|
if (hasTaskNodeStatusTool) {
|
|
@@ -40722,6 +40806,13 @@ class Agent {
|
|
|
40722
40806
|
callback?.onHumanHelp) {
|
|
40723
40807
|
tools.push(new HumanInteractTool());
|
|
40724
40808
|
}
|
|
40809
|
+
// Add skill tool when available
|
|
40810
|
+
if (global.skillService) {
|
|
40811
|
+
const skills = global.skillService.getAllMetadata().filter((s) => s.enabled);
|
|
40812
|
+
if (skills.length > 0) {
|
|
40813
|
+
tools.push(new ActivateSkillTool());
|
|
40814
|
+
}
|
|
40815
|
+
}
|
|
40725
40816
|
const toolNames = this.tools.map((tool) => tool.name);
|
|
40726
40817
|
return tools.filter((tool) => toolNames.indexOf(tool.name) == -1);
|
|
40727
40818
|
}
|
|
@@ -44718,8 +44809,20 @@ For non-chat related tasks issued by users, the following tools need to be calle
|
|
|
44718
44809
|
<if ${TOOL_NAME}Tool>
|
|
44719
44810
|
- ${TOOL_NAME}: This tool is used to read output variables from task nodes and write input variables to task nodes, mainly used to retrieve variable results after task execution is completed.
|
|
44720
44811
|
</if>
|
|
44812
|
+
<if ${TOOL_NAME$6}Tool>
|
|
44813
|
+
- ${TOOL_NAME$6}: Activate a specialized skill for domain-specific tasks. Use when the user's request matches an available skill.
|
|
44814
|
+
</if>
|
|
44721
44815
|
</tool_instructions>
|
|
44722
44816
|
|
|
44817
|
+
<if skills>
|
|
44818
|
+
## Available Skills
|
|
44819
|
+
You have access to specialized skills. Use activate_skill when the user's request matches a skill.
|
|
44820
|
+
When you see <use_skill name="..." /> in user messages, you MUST call activate_skill with that skill name immediately before proceeding.
|
|
44821
|
+
<available_skills>
|
|
44822
|
+
{{skills}}
|
|
44823
|
+
</available_skills>
|
|
44824
|
+
</if>
|
|
44825
|
+
|
|
44723
44826
|
<if memory>
|
|
44724
44827
|
The assistant always focuses on the user's current question and will not allow previous conversation turns or irrelevant memory content to interfere with the response to the user's current question. Each question should be handled independently unless it explicitly builds upon prior context.
|
|
44725
44828
|
Before responding to user questions, the assistant intelligently analyzes the relevance of memories. When responding, the assistant first determines whether the user's current question is related to information in the retrieved memories, and only incorporates memory data when there is clear contextual relevance. If the user's question is unrelated to the retrieved memories, the assistant will directly respond to the current question without referencing memory content, ensuring the conversation flows naturally.
|
|
@@ -44739,7 +44842,7 @@ The information about the browser tabs currently open by the user is as follows:
|
|
|
44739
44842
|
Current datetime: {{datetime}}
|
|
44740
44843
|
The output language should match the user's conversation language.
|
|
44741
44844
|
`;
|
|
44742
|
-
function getChatSystemPrompt(tools, datetime, memory, tabs) {
|
|
44845
|
+
function getChatSystemPrompt(tools, datetime, memory, tabs, skills) {
|
|
44743
44846
|
const systemPrompt = global.prompts.get(GlobalPromptKey.chat_system) || CHAT_SYSTEM_TEMPLATE;
|
|
44744
44847
|
const toolVars = {};
|
|
44745
44848
|
for (let i = 0; i < tools.length; i++) {
|
|
@@ -44750,6 +44853,7 @@ function getChatSystemPrompt(tools, datetime, memory, tabs) {
|
|
|
44750
44853
|
datetime: datetime,
|
|
44751
44854
|
memory: memory || "",
|
|
44752
44855
|
tabs: getTabsInfo(tabs),
|
|
44856
|
+
skills: skills || "",
|
|
44753
44857
|
...toolVars,
|
|
44754
44858
|
}).trim();
|
|
44755
44859
|
}
|
|
@@ -44871,8 +44975,15 @@ class ChatAgent {
|
|
|
44871
44975
|
Log.error("browser service load tabs error: ", e);
|
|
44872
44976
|
}
|
|
44873
44977
|
}
|
|
44978
|
+
let _skills;
|
|
44979
|
+
if (global.skillService) {
|
|
44980
|
+
const skills = global.skillService.getAllMetadata().filter((s) => s.enabled);
|
|
44981
|
+
if (skills.length > 0) {
|
|
44982
|
+
_skills = skills.map((s) => `- ${s.name}: ${s.description}`).join("\n");
|
|
44983
|
+
}
|
|
44984
|
+
}
|
|
44874
44985
|
const datetime = params.datetime || new Date().toLocaleString();
|
|
44875
|
-
const systemPrompt = getChatSystemPrompt(chatTools, datetime, _memory, _tabs);
|
|
44986
|
+
const systemPrompt = getChatSystemPrompt(chatTools, datetime, _memory, _tabs, _skills);
|
|
44876
44987
|
this.memory.setSystemPrompt(systemPrompt);
|
|
44877
44988
|
}
|
|
44878
44989
|
async addUserMessage(messageId, user) {
|
|
@@ -44899,9 +45010,13 @@ class ChatAgent {
|
|
|
44899
45010
|
}
|
|
44900
45011
|
tools.push(new WebSearchTool(this.chatContext, params));
|
|
44901
45012
|
tools.push(new TaskVariableStorageTool(this.chatContext, params));
|
|
44902
|
-
//
|
|
44903
|
-
|
|
44904
|
-
|
|
45013
|
+
// Add skill tool when service available and has enabled skills
|
|
45014
|
+
if (global.skillService) {
|
|
45015
|
+
const skills = global.skillService.getAllMetadata().filter((s) => s.enabled);
|
|
45016
|
+
if (skills.length > 0) {
|
|
45017
|
+
tools.push(new ActivateSkillTool());
|
|
45018
|
+
}
|
|
45019
|
+
}
|
|
44905
45020
|
return tools;
|
|
44906
45021
|
}
|
|
44907
45022
|
getMemory() {
|
|
@@ -45156,5 +45271,5 @@ class AgentWrapTool {
|
|
|
45156
45271
|
}
|
|
45157
45272
|
}
|
|
45158
45273
|
|
|
45159
|
-
export { Agent, AgentChain, AgentContext, AgentWrapTool, BaseBrowserAgent, BaseBrowserLabelsAgent, BaseBrowserScreenAgent, BaseFileAgent, Chain, ChatAgent, ChatContext, TaskContext as Context, DeepActionTool, Eko, EkoMemory, ForeachTaskTool, GlobalPromptKey, HumanInteractTool, Log, Planner, PromptTemplate, RetryLanguageModel, SimpleHttpMcpClient, SimpleSseMcpClient, TaskContext, TaskNodeStatusTool, TaskVariableStorageTool, VariableStorageTool, WatchTriggerTool, WebSearchTool, WebpageQaTool, buildAgentTree, buildSimpleAgentWorkflow, callLLM, callWithReAct, call_timeout, compressImageData, compressLargeContextMessages, config$1 as config, convertToolSchema, Eko as default, extract_page_content, fixJson, global, handleLargeContextMessages, mergeTools, parseWorkflow, resetWorkflowXml, sub, toFile, toImage, uuidv4 };
|
|
45274
|
+
export { ActivateSkillTool, Agent, AgentChain, AgentContext, AgentWrapTool, BaseBrowserAgent, BaseBrowserLabelsAgent, BaseBrowserScreenAgent, BaseFileAgent, Chain, ChatAgent, ChatContext, TaskContext as Context, DeepActionTool, Eko, EkoMemory, ForeachTaskTool, GlobalPromptKey, HumanInteractTool, Log, Planner, PromptTemplate, RetryLanguageModel, SimpleHttpMcpClient, SimpleSseMcpClient, TaskContext, TaskNodeStatusTool, TaskVariableStorageTool, VariableStorageTool, WatchTriggerTool, WebSearchTool, WebpageQaTool, buildAgentTree, buildSimpleAgentWorkflow, callLLM, callWithReAct, call_timeout, compressImageData, compressLargeContextMessages, config$1 as config, convertToolSchema, Eko as default, extract_page_content, fixJson, global, handleLargeContextMessages, mergeTools, parseWorkflow, resetWorkflowXml, sub, toFile, toImage, uuidv4 };
|
|
45160
45275
|
//# sourceMappingURL=index.esm.js.map
|