@jarvis-agent/core 0.2.6 → 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/tools/activate-skill-tool.d.ts +4 -2
- package/dist/chat/tools/activate-skill-tool.d.ts.map +1 -1
- package/dist/index.cjs +113 -86
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +113 -86
- package/dist/index.esm.js.map +1 -1
- package/dist/prompt/agent.d.ts.map +1 -1
- package/dist/prompt/chat.d.ts.map +1 -1
- 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,EAAE,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAK5D,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,UAAU,CAAC,EAAE,UAAU,EAAE,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAA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,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"}
|
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
* POSITION: Chat dialogue tool enabling LLM to load domain-specific skills
|
|
5
5
|
*/
|
|
6
6
|
import { JSONSchema7 } from "@ai-sdk/provider";
|
|
7
|
-
import { DialogueTool, ToolResult } from "../../types";
|
|
7
|
+
import { DialogueTool, Tool, ToolResult } from "../../types";
|
|
8
8
|
export declare const TOOL_NAME = "activate_skill";
|
|
9
|
-
|
|
9
|
+
/** Works as both DialogueTool (Chat) and Tool (Agent) */
|
|
10
|
+
export default class ActivateSkillTool implements DialogueTool, Tool {
|
|
10
11
|
readonly name: string;
|
|
12
|
+
readonly noPlan: boolean;
|
|
11
13
|
/** Dynamic description with available skill list */
|
|
12
14
|
get description(): string;
|
|
13
15
|
/** Dynamic parameters with enum constraint */
|
|
@@ -1 +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,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
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
|
@@ -40177,10 +40177,77 @@ class McpTool {
|
|
|
40177
40177
|
}
|
|
40178
40178
|
}
|
|
40179
40179
|
|
|
40180
|
-
|
|
40181
|
-
|
|
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 {
|
|
40182
40188
|
constructor() {
|
|
40183
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
|
+
|
|
40247
|
+
const TOOL_NAME$5 = "task_result_check";
|
|
40248
|
+
class TaskResultCheckTool {
|
|
40249
|
+
constructor() {
|
|
40250
|
+
this.name = TOOL_NAME$5;
|
|
40184
40251
|
this.description = `Check the current task execution process and results, evaluate the overall completion status of the current task, and whether the output variables in the nodes are stored.`;
|
|
40185
40252
|
this.parameters = {
|
|
40186
40253
|
type: "object",
|
|
@@ -40284,10 +40351,10 @@ async function doTaskResultCheck(agentContext, rlm, messages, tools) {
|
|
|
40284
40351
|
}
|
|
40285
40352
|
}
|
|
40286
40353
|
|
|
40287
|
-
const TOOL_NAME$
|
|
40354
|
+
const TOOL_NAME$4 = "todo_list_manager";
|
|
40288
40355
|
class TodoListManagerTool {
|
|
40289
40356
|
constructor() {
|
|
40290
|
-
this.name = TOOL_NAME$
|
|
40357
|
+
this.name = TOOL_NAME$4;
|
|
40291
40358
|
this.description =
|
|
40292
40359
|
"Current task to-do list management, used for managing the to-do list of current tasks. During task execution, the to-do list needs to be updated according to the task execution status: completed, pending. It also detects whether tasks are being executed in repetitive loops during the execution process.";
|
|
40293
40360
|
this.parameters = {
|
|
@@ -40440,6 +40507,14 @@ For repetitive tasks, when executing a forEach node, the \`${TOOL_NAME$b}\` tool
|
|
|
40440
40507
|
* watch node
|
|
40441
40508
|
monitor changes in webpage DOM elements, when executing to the watch node, require the use of the \`${TOOL_NAME$a}\` tool.
|
|
40442
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>
|
|
40517
|
+
</if>
|
|
40443
40518
|
|
|
40444
40519
|
<if mainTask>
|
|
40445
40520
|
Main task: {{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,
|
|
@@ -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
|
}
|
|
@@ -44279,7 +44370,7 @@ class ChatContext {
|
|
|
44279
44370
|
}
|
|
44280
44371
|
}
|
|
44281
44372
|
|
|
44282
|
-
const TOOL_NAME$
|
|
44373
|
+
const TOOL_NAME$3 = "webpageQa";
|
|
44283
44374
|
const WEBPAGE_QA_PROMPT = `
|
|
44284
44375
|
You are a helpful assistant that can answer questions based on the provided webpage context.
|
|
44285
44376
|
|
|
@@ -44300,7 +44391,7 @@ Answer user's question based on the webpage context, the answer should be in the
|
|
|
44300
44391
|
`;
|
|
44301
44392
|
class WebpageQaTool {
|
|
44302
44393
|
constructor(chatContext, params) {
|
|
44303
|
-
this.name = TOOL_NAME$
|
|
44394
|
+
this.name = TOOL_NAME$3;
|
|
44304
44395
|
this.params = params;
|
|
44305
44396
|
this.chatContext = chatContext;
|
|
44306
44397
|
this.description = `This tool is designed only for handling simple web-related tasks, including summarizing webpage content, extracting data from web pages, translating webpage content, and converting webpage information into more easily understandable forms. It does not interact with or operate web pages. For more complex browser tasks, please use deepAction.It does not perform operations on the webpage itself, but only involves reading the page content. Users do not need to provide the web page content, as the tool can automatically extract the content of the web page based on the tabId to respond.`;
|
|
@@ -44416,10 +44507,10 @@ class WebpageQaTool {
|
|
|
44416
44507
|
}
|
|
44417
44508
|
}
|
|
44418
44509
|
|
|
44419
|
-
const TOOL_NAME$
|
|
44510
|
+
const TOOL_NAME$2 = "webSearch";
|
|
44420
44511
|
class WebSearchTool {
|
|
44421
44512
|
constructor(chatContext, params) {
|
|
44422
|
-
this.name = TOOL_NAME$
|
|
44513
|
+
this.name = TOOL_NAME$2;
|
|
44423
44514
|
this.params = params;
|
|
44424
44515
|
this.chatContext = chatContext;
|
|
44425
44516
|
this.description = `Search the web for information using search engine API. This tool can perform web searches to find current information, news, articles, and other web content related to the query. It returns search results with titles, descriptions, URLs, and other relevant metadata, use this tool when users need the latest data/information and have NOT specified a particular platform or website, use the search tool.`;
|
|
@@ -44489,12 +44580,12 @@ async function recursiveTextNode(node, callback) {
|
|
|
44489
44580
|
}
|
|
44490
44581
|
}
|
|
44491
44582
|
|
|
44492
|
-
const TOOL_NAME$
|
|
44583
|
+
const TOOL_NAME$1 = "deepAction";
|
|
44493
44584
|
const deep_action_description = "Delegate tasks to a Javis AI assistant for completion. This assistant can understand natural language instructions and has full control over both networked computers, browser agent, and multiple specialized agents ({agentNames}). The assistant can autonomously decide to use various software tools, browse the internet to query information, write code, and perform direct operations to complete tasks. He can deliver various digitized outputs (text reports, tables, images, music, videos, websites, deepSearch, programs, etc.) and handle design/analysis tasks. and execute operational tasks (such as batch following bloggers of specific topics on certain websites). For operational tasks, the focus is on completing the process actions rather than delivering final outputs, and the assistant can complete these types of tasks well. It should also be noted that users may actively mention deepsearch, which is also one of the capabilities of this tool. If users mention it, please explicitly tell the assistant to use deepsearch. Supports parallel execution of multiple tasks.";
|
|
44494
44585
|
const deep_action_param_task_description = "Task description, please output the user's original instructions without omitting any information from the user's instructions, and use the same language as the user's question.";
|
|
44495
44586
|
class DeepActionTool {
|
|
44496
44587
|
constructor(chatContext, params) {
|
|
44497
|
-
this.name = TOOL_NAME$
|
|
44588
|
+
this.name = TOOL_NAME$1;
|
|
44498
44589
|
this.chatContext = chatContext;
|
|
44499
44590
|
const agents = this.chatContext.getConfig().agents || [];
|
|
44500
44591
|
const agentNames = agents.map((agent) => agent.Name).join(", ");
|
|
@@ -44651,10 +44742,10 @@ class DeepActionTool {
|
|
|
44651
44742
|
}
|
|
44652
44743
|
}
|
|
44653
44744
|
|
|
44654
|
-
const TOOL_NAME
|
|
44745
|
+
const TOOL_NAME = "taskVariableStorage";
|
|
44655
44746
|
class TaskVariableStorageTool {
|
|
44656
44747
|
constructor(chatContext, params) {
|
|
44657
|
-
this.name = TOOL_NAME
|
|
44748
|
+
this.name = TOOL_NAME;
|
|
44658
44749
|
this.params = params;
|
|
44659
44750
|
this.chatContext = chatContext;
|
|
44660
44751
|
this.description = `Used for storing, reading, and retrieving variable data, and maintaining input/output variables in task nodes.`;
|
|
@@ -44731,71 +44822,6 @@ class TaskVariableStorageTool {
|
|
|
44731
44822
|
}
|
|
44732
44823
|
}
|
|
44733
44824
|
|
|
44734
|
-
/**
|
|
44735
|
-
* INPUT: global.skillService for skill metadata and content
|
|
44736
|
-
* OUTPUT: Activated skill instructions + resource listing
|
|
44737
|
-
* POSITION: Chat dialogue tool enabling LLM to load domain-specific skills
|
|
44738
|
-
*/
|
|
44739
|
-
const TOOL_NAME = "activate_skill";
|
|
44740
|
-
class ActivateSkillTool {
|
|
44741
|
-
constructor() {
|
|
44742
|
-
this.name = TOOL_NAME;
|
|
44743
|
-
}
|
|
44744
|
-
/** Dynamic description with available skill list */
|
|
44745
|
-
get description() {
|
|
44746
|
-
const skills = global.skillService?.getAllMetadata()?.filter((s) => s.enabled) || [];
|
|
44747
|
-
if (skills.length === 0) {
|
|
44748
|
-
return "Activate a specialized skill. No skills currently available.";
|
|
44749
|
-
}
|
|
44750
|
-
const list = skills.map((s) => `- ${s.name}: ${s.description}`).join("\n");
|
|
44751
|
-
return `Activate a specialized skill that provides domain-specific instructions.\n\nAvailable skills:\n${list}`;
|
|
44752
|
-
}
|
|
44753
|
-
/** Dynamic parameters with enum constraint */
|
|
44754
|
-
get parameters() {
|
|
44755
|
-
const skillNames = (global.skillService?.getAllMetadata()?.filter((s) => s.enabled) || []).map((s) => s.name);
|
|
44756
|
-
return {
|
|
44757
|
-
type: "object",
|
|
44758
|
-
properties: {
|
|
44759
|
-
name: {
|
|
44760
|
-
type: "string",
|
|
44761
|
-
...(skillNames.length > 0 ? { enum: skillNames } : {}),
|
|
44762
|
-
description: "Name of the skill to activate",
|
|
44763
|
-
},
|
|
44764
|
-
},
|
|
44765
|
-
required: ["name"],
|
|
44766
|
-
};
|
|
44767
|
-
}
|
|
44768
|
-
async execute(args) {
|
|
44769
|
-
const name = args.name;
|
|
44770
|
-
if (!global.skillService) {
|
|
44771
|
-
return {
|
|
44772
|
-
content: [{ type: "text", text: "Skill service not available" }],
|
|
44773
|
-
isError: true,
|
|
44774
|
-
};
|
|
44775
|
-
}
|
|
44776
|
-
const skill = await global.skillService.loadSkill(name);
|
|
44777
|
-
if (!skill) {
|
|
44778
|
-
return {
|
|
44779
|
-
content: [{ type: "text", text: `Skill "${name}" not found` }],
|
|
44780
|
-
isError: true,
|
|
44781
|
-
};
|
|
44782
|
-
}
|
|
44783
|
-
const output = [
|
|
44784
|
-
`<activated_skill name="${skill.metadata.name}">`,
|
|
44785
|
-
`<instructions>`,
|
|
44786
|
-
skill.instructions.trim(),
|
|
44787
|
-
`</instructions>`,
|
|
44788
|
-
];
|
|
44789
|
-
if (skill.resources.length > 0) {
|
|
44790
|
-
output.push(`<available_resources base="${skill.basePath}">`);
|
|
44791
|
-
skill.resources.forEach((r) => output.push(` <file>${r}</file>`));
|
|
44792
|
-
output.push(`</available_resources>`);
|
|
44793
|
-
}
|
|
44794
|
-
output.push(`</activated_skill>`);
|
|
44795
|
-
return { content: [{ type: "text", text: output.join("\n") }] };
|
|
44796
|
-
}
|
|
44797
|
-
}
|
|
44798
|
-
|
|
44799
44825
|
const CHAT_SYSTEM_TEMPLATE = `
|
|
44800
44826
|
You are {{name}}, it is an action-oriented assistant in the browser, a general-purpose intelligent agent running in the browser environment.
|
|
44801
44827
|
|
|
@@ -44806,26 +44832,27 @@ General Principles:
|
|
|
44806
44832
|
- Users may switch topics multiple times during ongoing conversations. When calling tools, assistant must focus ONLY on the current user question and ignore previous conversation topics unless they are directly related to the current request. Each question should be treated as independent unless explicitly building on previous context.
|
|
44807
44833
|
|
|
44808
44834
|
For non-chat related tasks issued by users, the following tools need to be called to complete them:
|
|
44809
|
-
<if ${TOOL_NAME$
|
|
44810
|
-
- ${TOOL_NAME$
|
|
44811
|
-
</if>
|
|
44812
|
-
<if ${TOOL_NAME$4}Tool>
|
|
44813
|
-
- ${TOOL_NAME$4}: When a user's query involves finding content in a webpage within a browser tab, extracting webpage content, summarizing webpage content, translating webpage content, read PDF page content, or converting webpage content into a more understandable format, this tool should be used. If the task requires performing actions based on webpage content, deepAction should be used. only needs to provide the required invocation parameters according to the tool's needs; users do not need to manually provide the content of the browser tab.
|
|
44835
|
+
<if ${TOOL_NAME$1}Tool>
|
|
44836
|
+
- ${TOOL_NAME$1}: This tool is used to execute tasks, delegate to Javis AI assistant with full computer control.
|
|
44814
44837
|
</if>
|
|
44815
44838
|
<if ${TOOL_NAME$3}Tool>
|
|
44816
|
-
- ${TOOL_NAME$3}:
|
|
44839
|
+
- ${TOOL_NAME$3}: When a user's query involves finding content in a webpage within a browser tab, extracting webpage content, summarizing webpage content, translating webpage content, read PDF page content, or converting webpage content into a more understandable format, this tool should be used. If the task requires performing actions based on webpage content, deepAction should be used. only needs to provide the required invocation parameters according to the tool's needs; users do not need to manually provide the content of the browser tab.
|
|
44817
44840
|
</if>
|
|
44818
|
-
<if ${TOOL_NAME$
|
|
44819
|
-
- ${TOOL_NAME$
|
|
44841
|
+
<if ${TOOL_NAME$2}Tool>
|
|
44842
|
+
- ${TOOL_NAME$2}: Search the web for information using search engine API. This tool can perform web searches to find current information, news, articles, and other web content related to the query. It returns search results with titles, descriptions, URLs, and other relevant metadata. Use this tool when you need to find current information from the internet that may not be available in your training data.
|
|
44820
44843
|
</if>
|
|
44821
44844
|
<if ${TOOL_NAME}Tool>
|
|
44822
|
-
- ${TOOL_NAME}:
|
|
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.
|
|
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.
|
|
44823
44849
|
</if>
|
|
44824
44850
|
</tool_instructions>
|
|
44825
44851
|
|
|
44826
44852
|
<if skills>
|
|
44827
44853
|
## Available Skills
|
|
44828
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.
|
|
44829
44856
|
<available_skills>
|
|
44830
44857
|
{{skills}}
|
|
44831
44858
|
</available_skills>
|