@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/agent/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/agent/base.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/agent/base.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAa,MAAM,SAAS,CAAC;AAShD,OAAO,EACL,IAAI,EAEJ,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,aAAa,EACb,aAAa,EACb,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,4BAA4B,EAC5B,2BAA2B,EAC3B,6BAA6B,EAC9B,MAAM,kBAAkB,CAAC;AAS1B,OAAO,WAAW,EA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MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;IAgB9D,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAUtD,OAAO,CAAC,IAAI,EAAE,IAAI;cAIT,YAAY,CAC1B,MAAM,EAAE,OAAO,GAAG,OAAO,GAAG,cAAc,EAC1C,MAAM,CAAC,EAAE,MAAM;IAOV,oBAAoB,CACzB,SAAS,CAAC,EAAE,2BAA2B,EAAE,GACxC,OAAO;IAIV,IAAI,IAAI,IAAI,MAAM,EAAE,GAAG,SAAS,CAE/B;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,IAAI,KAAK,IAAI,IAAI,EAAE,CAElB;IAED,IAAI,eAAe,uBAElB;IAED,IAAI,UAAU,IAAI,UAAU,EAAE,CAE7B;IAED,IAAI,SAAS,IAAI,UAAU,GAAG,SAAS,CAEtC;IAED,IAAI,YAAY,IAAI,YAAY,GAAG,SAAS,CAE3C;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-agent.d.ts","sourceRoot":"","sources":["../../src/chat/chat-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAEV,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,4BAA4B,EAC5B,2BAA2B,EAE5B,MAAM,UAAU,CAAC;AASlB,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-agent.d.ts","sourceRoot":"","sources":["../../src/chat/chat-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAEV,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EAC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AM,GAAG,IAAI,CAAC;CA4E1B"}
|
package/dist/chat/index.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ import { WebpageQaTool } from "./tools/webpage-qa";
|
|
|
5
5
|
import AgentWrapTool from "./tools/agent-wrap-tool";
|
|
6
6
|
import { DeepActionTool } from "./tools/deep-action";
|
|
7
7
|
import { TaskVariableStorageTool } from "./tools/variable-storage";
|
|
8
|
-
|
|
8
|
+
import { ActivateSkillTool } from "./tools/activate-skill-tool";
|
|
9
|
+
export { ChatAgent, ChatContext, AgentWrapTool, WebSearchTool, WebpageQaTool, DeepActionTool, TaskVariableStorageTool, ActivateSkillTool, };
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/chat/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/chat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/chat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EACL,SAAS,EACT,WAAW,EACX,aAAa,EACb,aAAa,EACb,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,iBAAiB,GAClB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* INPUT: global.skillService for skill metadata and content
|
|
3
|
+
* OUTPUT: Activated skill instructions + resource listing
|
|
4
|
+
* POSITION: Chat dialogue tool enabling LLM to load domain-specific skills
|
|
5
|
+
*/
|
|
6
|
+
import { JSONSchema7 } from "@ai-sdk/provider";
|
|
7
|
+
import { DialogueTool, Tool, ToolResult } from "../../types";
|
|
8
|
+
export declare const TOOL_NAME = "activate_skill";
|
|
9
|
+
/** Works as both DialogueTool (Chat) and Tool (Agent) */
|
|
10
|
+
export default class ActivateSkillTool implements DialogueTool, Tool {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly noPlan: boolean;
|
|
13
|
+
/** Dynamic description with available skill list */
|
|
14
|
+
get description(): string;
|
|
15
|
+
/** Dynamic parameters with enum constraint */
|
|
16
|
+
get parameters(): JSONSchema7;
|
|
17
|
+
execute(args: Record<string, unknown>): Promise<ToolResult>;
|
|
18
|
+
}
|
|
19
|
+
export { ActivateSkillTool };
|
|
20
|
+
//# sourceMappingURL=activate-skill-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activate-skill-tool.d.ts","sourceRoot":"","sources":["../../../src/chat/tools/activate-skill-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,SAAS,mBAAmB,CAAC;AAE1C,yDAAyD;AACzD,MAAM,CAAC,OAAO,OAAO,iBAAkB,YAAW,YAAY,EAAE,IAAI;IAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAa;IAClC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAQ;IAEhC,oDAAoD;IACpD,IAAI,WAAW,IAAI,MAAM,CAQxB;IAED,8CAA8C;IAC9C,IAAI,UAAU,IAAI,WAAW,CAgB5B;IAEK,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;CAkClE;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -37056,10 +37056,10 @@ function resetWorkflowXml(workflow) {
|
|
|
37056
37056
|
workflow.xml = xml;
|
|
37057
37057
|
}
|
|
37058
37058
|
|
|
37059
|
-
const TOOL_NAME$
|
|
37059
|
+
const TOOL_NAME$c = "task_snapshot";
|
|
37060
37060
|
class TaskSnapshotTool {
|
|
37061
37061
|
constructor() {
|
|
37062
|
-
this.name = TOOL_NAME$
|
|
37062
|
+
this.name = TOOL_NAME$c;
|
|
37063
37063
|
this.description = `Task snapshot archive, recording key information of the current task, updating task node status, facilitating subsequent continuation of operation.`;
|
|
37064
37064
|
this.parameters = {
|
|
37065
37065
|
type: "object",
|
|
@@ -39628,10 +39628,10 @@ class ToolWrapper {
|
|
|
39628
39628
|
}
|
|
39629
39629
|
}
|
|
39630
39630
|
|
|
39631
|
-
const TOOL_NAME$
|
|
39631
|
+
const TOOL_NAME$b = "foreach_task";
|
|
39632
39632
|
class ForeachTaskTool {
|
|
39633
39633
|
constructor() {
|
|
39634
|
-
this.name = TOOL_NAME$
|
|
39634
|
+
this.name = TOOL_NAME$b;
|
|
39635
39635
|
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.`;
|
|
39636
39636
|
this.parameters = {
|
|
39637
39637
|
type: "object",
|
|
@@ -39687,7 +39687,7 @@ class ForeachTaskTool {
|
|
|
39687
39687
|
}
|
|
39688
39688
|
}
|
|
39689
39689
|
|
|
39690
|
-
const TOOL_NAME$
|
|
39690
|
+
const TOOL_NAME$a = "watch_trigger";
|
|
39691
39691
|
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.
|
|
39692
39692
|
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.
|
|
39693
39693
|
|
|
@@ -39706,7 +39706,7 @@ Output:
|
|
|
39706
39706
|
}`;
|
|
39707
39707
|
class WatchTriggerTool {
|
|
39708
39708
|
constructor() {
|
|
39709
|
-
this.name = TOOL_NAME$
|
|
39709
|
+
this.name = TOOL_NAME$a;
|
|
39710
39710
|
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.`;
|
|
39711
39711
|
this.parameters = {
|
|
39712
39712
|
type: "object",
|
|
@@ -39895,10 +39895,10 @@ class WatchTriggerTool {
|
|
|
39895
39895
|
}
|
|
39896
39896
|
}
|
|
39897
39897
|
|
|
39898
|
-
const TOOL_NAME$
|
|
39898
|
+
const TOOL_NAME$9 = "human_interact";
|
|
39899
39899
|
class HumanInteractTool {
|
|
39900
39900
|
constructor() {
|
|
39901
|
-
this.name = TOOL_NAME$
|
|
39901
|
+
this.name = TOOL_NAME$9;
|
|
39902
39902
|
this.noPlan = true;
|
|
39903
39903
|
this.description = `AI interacts with humans:
|
|
39904
39904
|
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.
|
|
@@ -40034,10 +40034,10 @@ request_help: Request assistance from the user; for instance, when an operation
|
|
|
40034
40034
|
}
|
|
40035
40035
|
}
|
|
40036
40036
|
|
|
40037
|
-
const TOOL_NAME$
|
|
40037
|
+
const TOOL_NAME$8 = "task_node_status";
|
|
40038
40038
|
class TaskNodeStatusTool {
|
|
40039
40039
|
constructor() {
|
|
40040
|
-
this.name = TOOL_NAME$
|
|
40040
|
+
this.name = TOOL_NAME$8;
|
|
40041
40041
|
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.`;
|
|
40042
40042
|
this.parameters = {
|
|
40043
40043
|
type: "object",
|
|
@@ -40089,10 +40089,10 @@ class TaskNodeStatusTool {
|
|
|
40089
40089
|
}
|
|
40090
40090
|
}
|
|
40091
40091
|
|
|
40092
|
-
const TOOL_NAME$
|
|
40092
|
+
const TOOL_NAME$7 = "variable_storage";
|
|
40093
40093
|
class VariableStorageTool {
|
|
40094
40094
|
constructor() {
|
|
40095
|
-
this.name = TOOL_NAME$
|
|
40095
|
+
this.name = TOOL_NAME$7;
|
|
40096
40096
|
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.`;
|
|
40097
40097
|
this.parameters = {
|
|
40098
40098
|
type: "object",
|
|
@@ -40177,6 +40177,73 @@ class McpTool {
|
|
|
40177
40177
|
}
|
|
40178
40178
|
}
|
|
40179
40179
|
|
|
40180
|
+
/**
|
|
40181
|
+
* INPUT: global.skillService for skill metadata and content
|
|
40182
|
+
* OUTPUT: Activated skill instructions + resource listing
|
|
40183
|
+
* POSITION: Chat dialogue tool enabling LLM to load domain-specific skills
|
|
40184
|
+
*/
|
|
40185
|
+
const TOOL_NAME$6 = "activate_skill";
|
|
40186
|
+
/** Works as both DialogueTool (Chat) and Tool (Agent) */
|
|
40187
|
+
class ActivateSkillTool {
|
|
40188
|
+
constructor() {
|
|
40189
|
+
this.name = TOOL_NAME$6;
|
|
40190
|
+
this.noPlan = true;
|
|
40191
|
+
}
|
|
40192
|
+
/** Dynamic description with available skill list */
|
|
40193
|
+
get description() {
|
|
40194
|
+
const skills = global.skillService?.getAllMetadata()?.filter((s) => s.enabled) || [];
|
|
40195
|
+
if (skills.length === 0) {
|
|
40196
|
+
return "Activate a specialized skill. No skills currently available.";
|
|
40197
|
+
}
|
|
40198
|
+
const list = skills.map((s) => `- ${s.name}: ${s.description}`).join("\n");
|
|
40199
|
+
return `Activate a specialized skill that provides domain-specific instructions.\n\nAvailable skills:\n${list}`;
|
|
40200
|
+
}
|
|
40201
|
+
/** Dynamic parameters with enum constraint */
|
|
40202
|
+
get parameters() {
|
|
40203
|
+
const skillNames = (global.skillService?.getAllMetadata()?.filter((s) => s.enabled) || []).map((s) => s.name);
|
|
40204
|
+
return {
|
|
40205
|
+
type: "object",
|
|
40206
|
+
properties: {
|
|
40207
|
+
name: {
|
|
40208
|
+
type: "string",
|
|
40209
|
+
...(skillNames.length > 0 ? { enum: skillNames } : {}),
|
|
40210
|
+
description: "Name of the skill to activate",
|
|
40211
|
+
},
|
|
40212
|
+
},
|
|
40213
|
+
required: ["name"],
|
|
40214
|
+
};
|
|
40215
|
+
}
|
|
40216
|
+
async execute(args) {
|
|
40217
|
+
const name = args.name;
|
|
40218
|
+
if (!global.skillService) {
|
|
40219
|
+
return {
|
|
40220
|
+
content: [{ type: "text", text: "Skill service not available" }],
|
|
40221
|
+
isError: true,
|
|
40222
|
+
};
|
|
40223
|
+
}
|
|
40224
|
+
const skill = await global.skillService.loadSkill(name);
|
|
40225
|
+
if (!skill) {
|
|
40226
|
+
return {
|
|
40227
|
+
content: [{ type: "text", text: `Skill "${name}" not found` }],
|
|
40228
|
+
isError: true,
|
|
40229
|
+
};
|
|
40230
|
+
}
|
|
40231
|
+
const output = [
|
|
40232
|
+
`<activated_skill name="${skill.metadata.name}">`,
|
|
40233
|
+
`<instructions>`,
|
|
40234
|
+
skill.instructions.trim(),
|
|
40235
|
+
`</instructions>`,
|
|
40236
|
+
];
|
|
40237
|
+
if (skill.resources.length > 0) {
|
|
40238
|
+
output.push(`<available_resources base="${skill.basePath}">`);
|
|
40239
|
+
skill.resources.forEach((r) => output.push(` <file>${r}</file>`));
|
|
40240
|
+
output.push(`</available_resources>`);
|
|
40241
|
+
}
|
|
40242
|
+
output.push(`</activated_skill>`);
|
|
40243
|
+
return { content: [{ type: "text", text: output.join("\n") }] };
|
|
40244
|
+
}
|
|
40245
|
+
}
|
|
40246
|
+
|
|
40180
40247
|
const TOOL_NAME$5 = "task_result_check";
|
|
40181
40248
|
class TaskResultCheckTool {
|
|
40182
40249
|
constructor() {
|
|
@@ -40419,26 +40486,34 @@ You are {{name}}, an autonomous AI agent for {{agent}} agent.
|
|
|
40419
40486
|
<if extSysPrompt>
|
|
40420
40487
|
{{extSysPrompt}}
|
|
40421
40488
|
</if>
|
|
40422
|
-
<if ${TOOL_NAME$
|
|
40489
|
+
<if ${TOOL_NAME$9}Tool>
|
|
40423
40490
|
* HUMAN INTERACT
|
|
40424
|
-
During the task execution process, you can use the \`${TOOL_NAME$
|
|
40491
|
+
During the task execution process, you can use the \`${TOOL_NAME$9}\` tool to interact with humans, please call it in the following situations:
|
|
40425
40492
|
- When performing dangerous operations such as deleting files, confirmation from humans is required.
|
|
40426
40493
|
- 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.
|
|
40427
|
-
- Please do not use the \`${TOOL_NAME$
|
|
40428
|
-
- The \`${TOOL_NAME$
|
|
40494
|
+
- Please do not use the \`${TOOL_NAME$9}\` tool frequently.
|
|
40495
|
+
- The \`${TOOL_NAME$9}\` tool does not support parallel calls.
|
|
40429
40496
|
</if>
|
|
40430
|
-
<if ${TOOL_NAME$
|
|
40497
|
+
<if ${TOOL_NAME$7}Tool>
|
|
40431
40498
|
* VARIABLE STORAGE
|
|
40432
|
-
When a step node has input/output variable attributes, use the \`${TOOL_NAME$
|
|
40433
|
-
The \`${TOOL_NAME$
|
|
40499
|
+
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.
|
|
40500
|
+
The \`${TOOL_NAME$7}\` tool does not support parallel calls.
|
|
40434
40501
|
</if>
|
|
40435
|
-
<if ${TOOL_NAME$
|
|
40502
|
+
<if ${TOOL_NAME$b}Tool>
|
|
40436
40503
|
* forEach node
|
|
40437
|
-
For repetitive tasks, when executing a forEach node, the \`${TOOL_NAME$
|
|
40504
|
+
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.
|
|
40438
40505
|
</if>
|
|
40439
|
-
<if ${TOOL_NAME$
|
|
40506
|
+
<if ${TOOL_NAME$a}Tool>
|
|
40440
40507
|
* watch node
|
|
40441
|
-
monitor changes in webpage DOM elements, when executing to the watch node, require the use of the \`${TOOL_NAME$
|
|
40508
|
+
monitor changes in webpage DOM elements, when executing to the watch node, require the use of the \`${TOOL_NAME$a}\` tool.
|
|
40509
|
+
</if>
|
|
40510
|
+
<if ${TOOL_NAME$6}Tool>
|
|
40511
|
+
* SKILLS
|
|
40512
|
+
You can use the \`${TOOL_NAME$6}\` tool to load domain-specific skill instructions when they would help complete the current task.
|
|
40513
|
+
<if skills>
|
|
40514
|
+
Available skills:
|
|
40515
|
+
{{skills}}
|
|
40516
|
+
</if>
|
|
40442
40517
|
</if>
|
|
40443
40518
|
|
|
40444
40519
|
<if mainTask>
|
|
@@ -40492,6 +40567,14 @@ function getAgentSystemPrompt(agent, agentNode, context, tools, extSysPrompt) {
|
|
|
40492
40567
|
for (let i = 0; i < tools.length; i++) {
|
|
40493
40568
|
toolVars[tools[i].name + "Tool"] = true;
|
|
40494
40569
|
}
|
|
40570
|
+
// Inject skill list when available
|
|
40571
|
+
let _skills = "";
|
|
40572
|
+
if (global.skillService) {
|
|
40573
|
+
const skills = global.skillService.getAllMetadata().filter((s) => s.enabled);
|
|
40574
|
+
if (skills.length > 0) {
|
|
40575
|
+
_skills = skills.map((s) => `- ${s.name}: ${s.description}`).join("\n");
|
|
40576
|
+
}
|
|
40577
|
+
}
|
|
40495
40578
|
let mainTask = "";
|
|
40496
40579
|
let preTaskResult = "";
|
|
40497
40580
|
if (context.chain.agents.length > 1) {
|
|
@@ -40504,6 +40587,7 @@ function getAgentSystemPrompt(agent, agentNode, context, tools, extSysPrompt) {
|
|
|
40504
40587
|
agent: agent.Name,
|
|
40505
40588
|
description: agent.Description,
|
|
40506
40589
|
extSysPrompt: extSysPrompt?.trim() || "",
|
|
40590
|
+
skills: _skills,
|
|
40507
40591
|
mainTask: mainTask,
|
|
40508
40592
|
preTaskResult: preTaskResult.trim(),
|
|
40509
40593
|
hasWatchNode: agentNode.xml.indexOf("</watch>") > -1,
|
|
@@ -40524,7 +40608,7 @@ function buildPreTaskResult(context) {
|
|
|
40524
40608
|
return preTaskResult.trim();
|
|
40525
40609
|
}
|
|
40526
40610
|
function getAgentUserPrompt(agent, agentNode, context, tools) {
|
|
40527
|
-
const hasTaskNodeStatusTool = (tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$
|
|
40611
|
+
const hasTaskNodeStatusTool = (tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$8)
|
|
40528
40612
|
.length > 0;
|
|
40529
40613
|
return buildAgentRootXml(agentNode.xml, context.chain.taskPrompt, (nodeId, node) => {
|
|
40530
40614
|
if (hasTaskNodeStatusTool) {
|
|
@@ -40757,6 +40841,13 @@ class Agent {
|
|
|
40757
40841
|
callback?.onHumanHelp) {
|
|
40758
40842
|
tools.push(new HumanInteractTool());
|
|
40759
40843
|
}
|
|
40844
|
+
// Add skill tool when available
|
|
40845
|
+
if (global.skillService) {
|
|
40846
|
+
const skills = global.skillService.getAllMetadata().filter((s) => s.enabled);
|
|
40847
|
+
if (skills.length > 0) {
|
|
40848
|
+
tools.push(new ActivateSkillTool());
|
|
40849
|
+
}
|
|
40850
|
+
}
|
|
40760
40851
|
const toolNames = this.tools.map((tool) => tool.name);
|
|
40761
40852
|
return tools.filter((tool) => toolNames.indexOf(tool.name) == -1);
|
|
40762
40853
|
}
|
|
@@ -44753,8 +44844,20 @@ For non-chat related tasks issued by users, the following tools need to be calle
|
|
|
44753
44844
|
<if ${TOOL_NAME}Tool>
|
|
44754
44845
|
- ${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.
|
|
44755
44846
|
</if>
|
|
44847
|
+
<if ${TOOL_NAME$6}Tool>
|
|
44848
|
+
- ${TOOL_NAME$6}: Activate a specialized skill for domain-specific tasks. Use when the user's request matches an available skill.
|
|
44849
|
+
</if>
|
|
44756
44850
|
</tool_instructions>
|
|
44757
44851
|
|
|
44852
|
+
<if skills>
|
|
44853
|
+
## Available Skills
|
|
44854
|
+
You have access to specialized skills. Use activate_skill when the user's request matches a skill.
|
|
44855
|
+
When you see <use_skill name="..." /> in user messages, you MUST call activate_skill with that skill name immediately before proceeding.
|
|
44856
|
+
<available_skills>
|
|
44857
|
+
{{skills}}
|
|
44858
|
+
</available_skills>
|
|
44859
|
+
</if>
|
|
44860
|
+
|
|
44758
44861
|
<if memory>
|
|
44759
44862
|
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.
|
|
44760
44863
|
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.
|
|
@@ -44774,7 +44877,7 @@ The information about the browser tabs currently open by the user is as follows:
|
|
|
44774
44877
|
Current datetime: {{datetime}}
|
|
44775
44878
|
The output language should match the user's conversation language.
|
|
44776
44879
|
`;
|
|
44777
|
-
function getChatSystemPrompt(tools, datetime, memory, tabs) {
|
|
44880
|
+
function getChatSystemPrompt(tools, datetime, memory, tabs, skills) {
|
|
44778
44881
|
const systemPrompt = global.prompts.get(exports.GlobalPromptKey.chat_system) || CHAT_SYSTEM_TEMPLATE;
|
|
44779
44882
|
const toolVars = {};
|
|
44780
44883
|
for (let i = 0; i < tools.length; i++) {
|
|
@@ -44785,6 +44888,7 @@ function getChatSystemPrompt(tools, datetime, memory, tabs) {
|
|
|
44785
44888
|
datetime: datetime,
|
|
44786
44889
|
memory: memory || "",
|
|
44787
44890
|
tabs: getTabsInfo(tabs),
|
|
44891
|
+
skills: skills || "",
|
|
44788
44892
|
...toolVars,
|
|
44789
44893
|
}).trim();
|
|
44790
44894
|
}
|
|
@@ -44906,8 +45010,15 @@ class ChatAgent {
|
|
|
44906
45010
|
Log.error("browser service load tabs error: ", e);
|
|
44907
45011
|
}
|
|
44908
45012
|
}
|
|
45013
|
+
let _skills;
|
|
45014
|
+
if (global.skillService) {
|
|
45015
|
+
const skills = global.skillService.getAllMetadata().filter((s) => s.enabled);
|
|
45016
|
+
if (skills.length > 0) {
|
|
45017
|
+
_skills = skills.map((s) => `- ${s.name}: ${s.description}`).join("\n");
|
|
45018
|
+
}
|
|
45019
|
+
}
|
|
44909
45020
|
const datetime = params.datetime || new Date().toLocaleString();
|
|
44910
|
-
const systemPrompt = getChatSystemPrompt(chatTools, datetime, _memory, _tabs);
|
|
45021
|
+
const systemPrompt = getChatSystemPrompt(chatTools, datetime, _memory, _tabs, _skills);
|
|
44911
45022
|
this.memory.setSystemPrompt(systemPrompt);
|
|
44912
45023
|
}
|
|
44913
45024
|
async addUserMessage(messageId, user) {
|
|
@@ -44934,9 +45045,13 @@ class ChatAgent {
|
|
|
44934
45045
|
}
|
|
44935
45046
|
tools.push(new WebSearchTool(this.chatContext, params));
|
|
44936
45047
|
tools.push(new TaskVariableStorageTool(this.chatContext, params));
|
|
44937
|
-
//
|
|
44938
|
-
|
|
44939
|
-
|
|
45048
|
+
// Add skill tool when service available and has enabled skills
|
|
45049
|
+
if (global.skillService) {
|
|
45050
|
+
const skills = global.skillService.getAllMetadata().filter((s) => s.enabled);
|
|
45051
|
+
if (skills.length > 0) {
|
|
45052
|
+
tools.push(new ActivateSkillTool());
|
|
45053
|
+
}
|
|
45054
|
+
}
|
|
44940
45055
|
return tools;
|
|
44941
45056
|
}
|
|
44942
45057
|
getMemory() {
|
|
@@ -45191,6 +45306,7 @@ class AgentWrapTool {
|
|
|
45191
45306
|
}
|
|
45192
45307
|
}
|
|
45193
45308
|
|
|
45309
|
+
exports.ActivateSkillTool = ActivateSkillTool;
|
|
45194
45310
|
exports.Agent = Agent;
|
|
45195
45311
|
exports.AgentChain = AgentChain;
|
|
45196
45312
|
exports.AgentContext = AgentContext;
|