@jarvis-agent/core 0.2.4 → 0.2.6

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.
@@ -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;AAS7C,qBAAa,SAAS;IACpB,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC;IAC5B,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,CAAC;IAChC,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IACnC,SAAS,CAAC,eAAe,EAAE,MAAM,CAAM;gBAGrC,MAAM,EAAE,iBAAiB,EACzB,MAAM,GAAE,MAA2B,EACnC,MAAM,CAAC,EAAE,SAAS,EAClB,KAAK,CAAC,EAAE,YAAY,EAAE;IAQX,IAAI,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAsE7C,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;cAe1B,iBAAiB,CAC/B,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,YAAY,EAAE,GACxB,OAAO,CAAC,IAAI,CAAC;cAsCA,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,kBAAkB,EAAE,GACzB,OAAO,CAAC,UAAU,CAAC;cAWN,WAAW,CACzB,QAAQ,EAAE,UAAU,EAAE,EACtB,OAAO,GAAE,OAAc,GACtB,OAAO,CAAC,IAAI,CAAC;IAUhB,SAAS,CAAC,eAAe,CAAC,MAAM,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A0B3B;AAED,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,6BAA6B,EAAE,GAC3C,kBAAkB,EAAE,CA0BtB;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,KAAK,CAAC,uBAAuB,GAAG,uBAAuB,CAAC,GAChE,kBAAkB,EAAE,CAgBtB"}
@@ -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
- export { ChatAgent, ChatContext, AgentWrapTool, WebSearchTool, WebpageQaTool, DeepActionTool, TaskVariableStorageTool, };
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
@@ -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;AAEnE,OAAO,EACL,SAAS,EACT,WAAW,EACX,aAAa,EACb,aAAa,EACb,aAAa,EACb,cAAc,EACd,uBAAuB,GACxB,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,18 @@
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, ToolResult } from "../../types";
8
+ export declare const TOOL_NAME = "activate_skill";
9
+ export default class ActivateSkillTool implements DialogueTool {
10
+ readonly name: string;
11
+ /** Dynamic description with available skill list */
12
+ get description(): string;
13
+ /** Dynamic parameters with enum constraint */
14
+ get parameters(): JSONSchema7;
15
+ execute(args: Record<string, unknown>): Promise<ToolResult>;
16
+ }
17
+ export { ActivateSkillTool };
18
+ //# 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,UAAU,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,SAAS,mBAAmB,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,iBAAkB,YAAW,YAAY;IAC5D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAa;IAElC,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$b = "task_snapshot";
37059
+ const TOOL_NAME$c = "task_snapshot";
37060
37060
  class TaskSnapshotTool {
37061
37061
  constructor() {
37062
- this.name = TOOL_NAME$b;
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$a = "foreach_task";
39631
+ const TOOL_NAME$b = "foreach_task";
39632
39632
  class ForeachTaskTool {
39633
39633
  constructor() {
39634
- this.name = TOOL_NAME$a;
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$9 = "watch_trigger";
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$9;
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$8 = "human_interact";
39898
+ const TOOL_NAME$9 = "human_interact";
39899
39899
  class HumanInteractTool {
39900
39900
  constructor() {
39901
- this.name = TOOL_NAME$8;
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$7 = "task_node_status";
40037
+ const TOOL_NAME$8 = "task_node_status";
40038
40038
  class TaskNodeStatusTool {
40039
40039
  constructor() {
40040
- this.name = TOOL_NAME$7;
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$6 = "variable_storage";
40092
+ const TOOL_NAME$7 = "variable_storage";
40093
40093
  class VariableStorageTool {
40094
40094
  constructor() {
40095
- this.name = TOOL_NAME$6;
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,10 +40177,10 @@ class McpTool {
40177
40177
  }
40178
40178
  }
40179
40179
 
40180
- const TOOL_NAME$5 = "task_result_check";
40180
+ const TOOL_NAME$6 = "task_result_check";
40181
40181
  class TaskResultCheckTool {
40182
40182
  constructor() {
40183
- this.name = TOOL_NAME$5;
40183
+ this.name = TOOL_NAME$6;
40184
40184
  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
40185
  this.parameters = {
40186
40186
  type: "object",
@@ -40284,10 +40284,10 @@ async function doTaskResultCheck(agentContext, rlm, messages, tools) {
40284
40284
  }
40285
40285
  }
40286
40286
 
40287
- const TOOL_NAME$4 = "todo_list_manager";
40287
+ const TOOL_NAME$5 = "todo_list_manager";
40288
40288
  class TodoListManagerTool {
40289
40289
  constructor() {
40290
- this.name = TOOL_NAME$4;
40290
+ this.name = TOOL_NAME$5;
40291
40291
  this.description =
40292
40292
  "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
40293
  this.parameters = {
@@ -40419,26 +40419,26 @@ You are {{name}}, an autonomous AI agent for {{agent}} agent.
40419
40419
  <if extSysPrompt>
40420
40420
  {{extSysPrompt}}
40421
40421
  </if>
40422
- <if ${TOOL_NAME$8}Tool>
40422
+ <if ${TOOL_NAME$9}Tool>
40423
40423
  * HUMAN INTERACT
40424
- During the task execution process, you can use the \`${TOOL_NAME$8}\` tool to interact with humans, please call it in the following situations:
40424
+ 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
40425
  - When performing dangerous operations such as deleting files, confirmation from humans is required.
40426
40426
  - 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$8}\` tool frequently.
40428
- - The \`${TOOL_NAME$8}\` tool does not support parallel calls.
40427
+ - Please do not use the \`${TOOL_NAME$9}\` tool frequently.
40428
+ - The \`${TOOL_NAME$9}\` tool does not support parallel calls.
40429
40429
  </if>
40430
- <if ${TOOL_NAME$6}Tool>
40430
+ <if ${TOOL_NAME$7}Tool>
40431
40431
  * VARIABLE STORAGE
40432
- When a step node has input/output variable attributes, use the \`${TOOL_NAME$6}\` tool to read from and write to these variables, these variables enable context sharing and coordination between multiple agents.
40433
- The \`${TOOL_NAME$6}\` tool does not support parallel calls.
40432
+ 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.
40433
+ The \`${TOOL_NAME$7}\` tool does not support parallel calls.
40434
40434
  </if>
40435
- <if ${TOOL_NAME$a}Tool>
40435
+ <if ${TOOL_NAME$b}Tool>
40436
40436
  * forEach node
40437
- For repetitive tasks, when executing a forEach node, the \`${TOOL_NAME$a}\` tool must be used. Loop tasks support parallel tool calls, and during parallel execution, this tool needs to be called interspersed throughout the process.
40437
+ 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
40438
  </if>
40439
- <if ${TOOL_NAME$9}Tool>
40439
+ <if ${TOOL_NAME$a}Tool>
40440
40440
  * watch node
40441
- monitor changes in webpage DOM elements, when executing to the watch node, require the use of the \`${TOOL_NAME$9}\` tool.
40441
+ monitor changes in webpage DOM elements, when executing to the watch node, require the use of the \`${TOOL_NAME$a}\` tool.
40442
40442
  </if>
40443
40443
 
40444
40444
  <if mainTask>
@@ -40524,7 +40524,7 @@ function buildPreTaskResult(context) {
40524
40524
  return preTaskResult.trim();
40525
40525
  }
40526
40526
  function getAgentUserPrompt(agent, agentNode, context, tools) {
40527
- const hasTaskNodeStatusTool = (tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$7)
40527
+ const hasTaskNodeStatusTool = (tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$8)
40528
40528
  .length > 0;
40529
40529
  return buildAgentRootXml(agentNode.xml, context.chain.taskPrompt, (nodeId, node) => {
40530
40530
  if (hasTaskNodeStatusTool) {
@@ -44200,13 +44200,19 @@ async function callChatLLM(chatId, messageId, rlm, messages, tools, toolChoice,
44200
44200
  });
44201
44201
  }
44202
44202
  function convertAssistantToolResults(results) {
44203
- return results.filter((part) => part.type !== "reasoning").map((part) => {
44203
+ return results.map((part) => {
44204
44204
  if (part.type == "text") {
44205
44205
  return {
44206
44206
  type: "text",
44207
44207
  text: part.text,
44208
44208
  };
44209
44209
  }
44210
+ else if (part.type == "reasoning") {
44211
+ return {
44212
+ type: "reasoning",
44213
+ text: part.text,
44214
+ };
44215
+ }
44210
44216
  else if (part.type == "tool-call") {
44211
44217
  return {
44212
44218
  type: "tool-call",
@@ -44273,7 +44279,7 @@ class ChatContext {
44273
44279
  }
44274
44280
  }
44275
44281
 
44276
- const TOOL_NAME$3 = "webpageQa";
44282
+ const TOOL_NAME$4 = "webpageQa";
44277
44283
  const WEBPAGE_QA_PROMPT = `
44278
44284
  You are a helpful assistant that can answer questions based on the provided webpage context.
44279
44285
 
@@ -44294,7 +44300,7 @@ Answer user's question based on the webpage context, the answer should be in the
44294
44300
  `;
44295
44301
  class WebpageQaTool {
44296
44302
  constructor(chatContext, params) {
44297
- this.name = TOOL_NAME$3;
44303
+ this.name = TOOL_NAME$4;
44298
44304
  this.params = params;
44299
44305
  this.chatContext = chatContext;
44300
44306
  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.`;
@@ -44410,10 +44416,10 @@ class WebpageQaTool {
44410
44416
  }
44411
44417
  }
44412
44418
 
44413
- const TOOL_NAME$2 = "webSearch";
44419
+ const TOOL_NAME$3 = "webSearch";
44414
44420
  class WebSearchTool {
44415
44421
  constructor(chatContext, params) {
44416
- this.name = TOOL_NAME$2;
44422
+ this.name = TOOL_NAME$3;
44417
44423
  this.params = params;
44418
44424
  this.chatContext = chatContext;
44419
44425
  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.`;
@@ -44483,12 +44489,12 @@ async function recursiveTextNode(node, callback) {
44483
44489
  }
44484
44490
  }
44485
44491
 
44486
- const TOOL_NAME$1 = "deepAction";
44492
+ const TOOL_NAME$2 = "deepAction";
44487
44493
  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.";
44488
44494
  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.";
44489
44495
  class DeepActionTool {
44490
44496
  constructor(chatContext, params) {
44491
- this.name = TOOL_NAME$1;
44497
+ this.name = TOOL_NAME$2;
44492
44498
  this.chatContext = chatContext;
44493
44499
  const agents = this.chatContext.getConfig().agents || [];
44494
44500
  const agentNames = agents.map((agent) => agent.Name).join(", ");
@@ -44645,10 +44651,10 @@ class DeepActionTool {
44645
44651
  }
44646
44652
  }
44647
44653
 
44648
- const TOOL_NAME = "taskVariableStorage";
44654
+ const TOOL_NAME$1 = "taskVariableStorage";
44649
44655
  class TaskVariableStorageTool {
44650
44656
  constructor(chatContext, params) {
44651
- this.name = TOOL_NAME;
44657
+ this.name = TOOL_NAME$1;
44652
44658
  this.params = params;
44653
44659
  this.chatContext = chatContext;
44654
44660
  this.description = `Used for storing, reading, and retrieving variable data, and maintaining input/output variables in task nodes.`;
@@ -44725,6 +44731,71 @@ class TaskVariableStorageTool {
44725
44731
  }
44726
44732
  }
44727
44733
 
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
+
44728
44799
  const CHAT_SYSTEM_TEMPLATE = `
44729
44800
  You are {{name}}, it is an action-oriented assistant in the browser, a general-purpose intelligent agent running in the browser environment.
44730
44801
 
@@ -44735,20 +44806,31 @@ General Principles:
44735
44806
  - 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.
44736
44807
 
44737
44808
  For non-chat related tasks issued by users, the following tools need to be called to complete them:
44738
- <if ${TOOL_NAME$1}Tool>
44739
- - ${TOOL_NAME$1}: This tool is used to execute tasks, delegate to Javis AI assistant with full computer control.
44809
+ <if ${TOOL_NAME$2}Tool>
44810
+ - ${TOOL_NAME$2}: This tool is used to execute tasks, delegate to Javis AI assistant with full computer control.
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.
44740
44814
  </if>
44741
44815
  <if ${TOOL_NAME$3}Tool>
44742
- - ${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.
44816
+ - ${TOOL_NAME$3}: 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.
44743
44817
  </if>
44744
- <if ${TOOL_NAME$2}Tool>
44745
- - ${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.
44818
+ <if ${TOOL_NAME$1}Tool>
44819
+ - ${TOOL_NAME$1}: 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.
44746
44820
  </if>
44747
44821
  <if ${TOOL_NAME}Tool>
44748
- - ${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.
44822
+ - ${TOOL_NAME}: Activate a specialized skill for domain-specific tasks. Use when the user's request matches an available skill.
44749
44823
  </if>
44750
44824
  </tool_instructions>
44751
44825
 
44826
+ <if skills>
44827
+ ## Available Skills
44828
+ You have access to specialized skills. Use activate_skill when the user's request matches a skill.
44829
+ <available_skills>
44830
+ {{skills}}
44831
+ </available_skills>
44832
+ </if>
44833
+
44752
44834
  <if memory>
44753
44835
  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.
44754
44836
  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.
@@ -44768,7 +44850,7 @@ The information about the browser tabs currently open by the user is as follows:
44768
44850
  Current datetime: {{datetime}}
44769
44851
  The output language should match the user's conversation language.
44770
44852
  `;
44771
- function getChatSystemPrompt(tools, datetime, memory, tabs) {
44853
+ function getChatSystemPrompt(tools, datetime, memory, tabs, skills) {
44772
44854
  const systemPrompt = global.prompts.get(exports.GlobalPromptKey.chat_system) || CHAT_SYSTEM_TEMPLATE;
44773
44855
  const toolVars = {};
44774
44856
  for (let i = 0; i < tools.length; i++) {
@@ -44779,6 +44861,7 @@ function getChatSystemPrompt(tools, datetime, memory, tabs) {
44779
44861
  datetime: datetime,
44780
44862
  memory: memory || "",
44781
44863
  tabs: getTabsInfo(tabs),
44864
+ skills: skills || "",
44782
44865
  ...toolVars,
44783
44866
  }).trim();
44784
44867
  }
@@ -44900,8 +44983,15 @@ class ChatAgent {
44900
44983
  Log.error("browser service load tabs error: ", e);
44901
44984
  }
44902
44985
  }
44986
+ let _skills;
44987
+ if (global.skillService) {
44988
+ const skills = global.skillService.getAllMetadata().filter((s) => s.enabled);
44989
+ if (skills.length > 0) {
44990
+ _skills = skills.map((s) => `- ${s.name}: ${s.description}`).join("\n");
44991
+ }
44992
+ }
44903
44993
  const datetime = params.datetime || new Date().toLocaleString();
44904
- const systemPrompt = getChatSystemPrompt(chatTools, datetime, _memory, _tabs);
44994
+ const systemPrompt = getChatSystemPrompt(chatTools, datetime, _memory, _tabs, _skills);
44905
44995
  this.memory.setSystemPrompt(systemPrompt);
44906
44996
  }
44907
44997
  async addUserMessage(messageId, user) {
@@ -44928,9 +45018,13 @@ class ChatAgent {
44928
45018
  }
44929
45019
  tools.push(new WebSearchTool(this.chatContext, params));
44930
45020
  tools.push(new TaskVariableStorageTool(this.chatContext, params));
44931
- // this.chatContext.getConfig().agents?.forEach((agent) => {
44932
- // tools.push(new AgentWrapTool(this.chatContext, params, agent));
44933
- // });
45021
+ // Add skill tool when service available and has enabled skills
45022
+ if (global.skillService) {
45023
+ const skills = global.skillService.getAllMetadata().filter((s) => s.enabled);
45024
+ if (skills.length > 0) {
45025
+ tools.push(new ActivateSkillTool());
45026
+ }
45027
+ }
44934
45028
  return tools;
44935
45029
  }
44936
45030
  getMemory() {
@@ -45185,6 +45279,7 @@ class AgentWrapTool {
45185
45279
  }
45186
45280
  }
45187
45281
 
45282
+ exports.ActivateSkillTool = ActivateSkillTool;
45188
45283
  exports.Agent = Agent;
45189
45284
  exports.AgentChain = AgentChain;
45190
45285
  exports.AgentContext = AgentContext;