@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.
- package/dist/chat/chat-agent.d.ts.map +1 -1
- package/dist/chat/chat-llm.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 +18 -0
- package/dist/chat/tools/activate-skill-tool.d.ts.map +1 -0
- package/dist/index.cjs +143 -48
- 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 +143 -49
- package/dist/index.esm.js.map +1 -1
- package/dist/prompt/chat.d.ts +1 -1
- package/dist/prompt/chat.d.ts.map +1 -1
- package/dist/types/chat.types.d.ts +3 -0
- package/dist/types/chat.types.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,10 +40142,10 @@ class McpTool {
|
|
|
40142
40142
|
}
|
|
40143
40143
|
}
|
|
40144
40144
|
|
|
40145
|
-
const TOOL_NAME$
|
|
40145
|
+
const TOOL_NAME$6 = "task_result_check";
|
|
40146
40146
|
class TaskResultCheckTool {
|
|
40147
40147
|
constructor() {
|
|
40148
|
-
this.name = TOOL_NAME$
|
|
40148
|
+
this.name = TOOL_NAME$6;
|
|
40149
40149
|
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.`;
|
|
40150
40150
|
this.parameters = {
|
|
40151
40151
|
type: "object",
|
|
@@ -40249,10 +40249,10 @@ async function doTaskResultCheck(agentContext, rlm, messages, tools) {
|
|
|
40249
40249
|
}
|
|
40250
40250
|
}
|
|
40251
40251
|
|
|
40252
|
-
const TOOL_NAME$
|
|
40252
|
+
const TOOL_NAME$5 = "todo_list_manager";
|
|
40253
40253
|
class TodoListManagerTool {
|
|
40254
40254
|
constructor() {
|
|
40255
|
-
this.name = TOOL_NAME$
|
|
40255
|
+
this.name = TOOL_NAME$5;
|
|
40256
40256
|
this.description =
|
|
40257
40257
|
"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.";
|
|
40258
40258
|
this.parameters = {
|
|
@@ -40384,26 +40384,26 @@ You are {{name}}, an autonomous AI agent for {{agent}} agent.
|
|
|
40384
40384
|
<if extSysPrompt>
|
|
40385
40385
|
{{extSysPrompt}}
|
|
40386
40386
|
</if>
|
|
40387
|
-
<if ${TOOL_NAME$
|
|
40387
|
+
<if ${TOOL_NAME$9}Tool>
|
|
40388
40388
|
* HUMAN INTERACT
|
|
40389
|
-
During the task execution process, you can use the \`${TOOL_NAME$
|
|
40389
|
+
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
40390
|
- When performing dangerous operations such as deleting files, confirmation from humans is required.
|
|
40391
40391
|
- 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$
|
|
40392
|
+
- Please do not use the \`${TOOL_NAME$9}\` tool frequently.
|
|
40393
|
+
- The \`${TOOL_NAME$9}\` tool does not support parallel calls.
|
|
40394
40394
|
</if>
|
|
40395
|
-
<if ${TOOL_NAME$
|
|
40395
|
+
<if ${TOOL_NAME$7}Tool>
|
|
40396
40396
|
* VARIABLE STORAGE
|
|
40397
|
-
When a step node has input/output variable attributes, use the \`${TOOL_NAME$
|
|
40398
|
-
The \`${TOOL_NAME$
|
|
40397
|
+
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.
|
|
40398
|
+
The \`${TOOL_NAME$7}\` tool does not support parallel calls.
|
|
40399
40399
|
</if>
|
|
40400
|
-
<if ${TOOL_NAME$
|
|
40400
|
+
<if ${TOOL_NAME$b}Tool>
|
|
40401
40401
|
* forEach node
|
|
40402
|
-
For repetitive tasks, when executing a forEach node, the \`${TOOL_NAME$
|
|
40402
|
+
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
40403
|
</if>
|
|
40404
|
-
<if ${TOOL_NAME$
|
|
40404
|
+
<if ${TOOL_NAME$a}Tool>
|
|
40405
40405
|
* watch node
|
|
40406
|
-
monitor changes in webpage DOM elements, when executing to the watch node, require the use of the \`${TOOL_NAME$
|
|
40406
|
+
monitor changes in webpage DOM elements, when executing to the watch node, require the use of the \`${TOOL_NAME$a}\` tool.
|
|
40407
40407
|
</if>
|
|
40408
40408
|
|
|
40409
40409
|
<if mainTask>
|
|
@@ -40489,7 +40489,7 @@ function buildPreTaskResult(context) {
|
|
|
40489
40489
|
return preTaskResult.trim();
|
|
40490
40490
|
}
|
|
40491
40491
|
function getAgentUserPrompt(agent, agentNode, context, tools) {
|
|
40492
|
-
const hasTaskNodeStatusTool = (tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$
|
|
40492
|
+
const hasTaskNodeStatusTool = (tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$8)
|
|
40493
40493
|
.length > 0;
|
|
40494
40494
|
return buildAgentRootXml(agentNode.xml, context.chain.taskPrompt, (nodeId, node) => {
|
|
40495
40495
|
if (hasTaskNodeStatusTool) {
|
|
@@ -44165,13 +44165,19 @@ async function callChatLLM(chatId, messageId, rlm, messages, tools, toolChoice,
|
|
|
44165
44165
|
});
|
|
44166
44166
|
}
|
|
44167
44167
|
function convertAssistantToolResults(results) {
|
|
44168
|
-
return results.
|
|
44168
|
+
return results.map((part) => {
|
|
44169
44169
|
if (part.type == "text") {
|
|
44170
44170
|
return {
|
|
44171
44171
|
type: "text",
|
|
44172
44172
|
text: part.text,
|
|
44173
44173
|
};
|
|
44174
44174
|
}
|
|
44175
|
+
else if (part.type == "reasoning") {
|
|
44176
|
+
return {
|
|
44177
|
+
type: "reasoning",
|
|
44178
|
+
text: part.text,
|
|
44179
|
+
};
|
|
44180
|
+
}
|
|
44175
44181
|
else if (part.type == "tool-call") {
|
|
44176
44182
|
return {
|
|
44177
44183
|
type: "tool-call",
|
|
@@ -44238,7 +44244,7 @@ class ChatContext {
|
|
|
44238
44244
|
}
|
|
44239
44245
|
}
|
|
44240
44246
|
|
|
44241
|
-
const TOOL_NAME$
|
|
44247
|
+
const TOOL_NAME$4 = "webpageQa";
|
|
44242
44248
|
const WEBPAGE_QA_PROMPT = `
|
|
44243
44249
|
You are a helpful assistant that can answer questions based on the provided webpage context.
|
|
44244
44250
|
|
|
@@ -44259,7 +44265,7 @@ Answer user's question based on the webpage context, the answer should be in the
|
|
|
44259
44265
|
`;
|
|
44260
44266
|
class WebpageQaTool {
|
|
44261
44267
|
constructor(chatContext, params) {
|
|
44262
|
-
this.name = TOOL_NAME$
|
|
44268
|
+
this.name = TOOL_NAME$4;
|
|
44263
44269
|
this.params = params;
|
|
44264
44270
|
this.chatContext = chatContext;
|
|
44265
44271
|
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.`;
|
|
@@ -44375,10 +44381,10 @@ class WebpageQaTool {
|
|
|
44375
44381
|
}
|
|
44376
44382
|
}
|
|
44377
44383
|
|
|
44378
|
-
const TOOL_NAME$
|
|
44384
|
+
const TOOL_NAME$3 = "webSearch";
|
|
44379
44385
|
class WebSearchTool {
|
|
44380
44386
|
constructor(chatContext, params) {
|
|
44381
|
-
this.name = TOOL_NAME$
|
|
44387
|
+
this.name = TOOL_NAME$3;
|
|
44382
44388
|
this.params = params;
|
|
44383
44389
|
this.chatContext = chatContext;
|
|
44384
44390
|
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.`;
|
|
@@ -44448,12 +44454,12 @@ async function recursiveTextNode(node, callback) {
|
|
|
44448
44454
|
}
|
|
44449
44455
|
}
|
|
44450
44456
|
|
|
44451
|
-
const TOOL_NAME$
|
|
44457
|
+
const TOOL_NAME$2 = "deepAction";
|
|
44452
44458
|
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.";
|
|
44453
44459
|
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.";
|
|
44454
44460
|
class DeepActionTool {
|
|
44455
44461
|
constructor(chatContext, params) {
|
|
44456
|
-
this.name = TOOL_NAME$
|
|
44462
|
+
this.name = TOOL_NAME$2;
|
|
44457
44463
|
this.chatContext = chatContext;
|
|
44458
44464
|
const agents = this.chatContext.getConfig().agents || [];
|
|
44459
44465
|
const agentNames = agents.map((agent) => agent.Name).join(", ");
|
|
@@ -44610,10 +44616,10 @@ class DeepActionTool {
|
|
|
44610
44616
|
}
|
|
44611
44617
|
}
|
|
44612
44618
|
|
|
44613
|
-
const TOOL_NAME = "taskVariableStorage";
|
|
44619
|
+
const TOOL_NAME$1 = "taskVariableStorage";
|
|
44614
44620
|
class TaskVariableStorageTool {
|
|
44615
44621
|
constructor(chatContext, params) {
|
|
44616
|
-
this.name = TOOL_NAME;
|
|
44622
|
+
this.name = TOOL_NAME$1;
|
|
44617
44623
|
this.params = params;
|
|
44618
44624
|
this.chatContext = chatContext;
|
|
44619
44625
|
this.description = `Used for storing, reading, and retrieving variable data, and maintaining input/output variables in task nodes.`;
|
|
@@ -44690,6 +44696,71 @@ class TaskVariableStorageTool {
|
|
|
44690
44696
|
}
|
|
44691
44697
|
}
|
|
44692
44698
|
|
|
44699
|
+
/**
|
|
44700
|
+
* INPUT: global.skillService for skill metadata and content
|
|
44701
|
+
* OUTPUT: Activated skill instructions + resource listing
|
|
44702
|
+
* POSITION: Chat dialogue tool enabling LLM to load domain-specific skills
|
|
44703
|
+
*/
|
|
44704
|
+
const TOOL_NAME = "activate_skill";
|
|
44705
|
+
class ActivateSkillTool {
|
|
44706
|
+
constructor() {
|
|
44707
|
+
this.name = TOOL_NAME;
|
|
44708
|
+
}
|
|
44709
|
+
/** Dynamic description with available skill list */
|
|
44710
|
+
get description() {
|
|
44711
|
+
const skills = global.skillService?.getAllMetadata()?.filter((s) => s.enabled) || [];
|
|
44712
|
+
if (skills.length === 0) {
|
|
44713
|
+
return "Activate a specialized skill. No skills currently available.";
|
|
44714
|
+
}
|
|
44715
|
+
const list = skills.map((s) => `- ${s.name}: ${s.description}`).join("\n");
|
|
44716
|
+
return `Activate a specialized skill that provides domain-specific instructions.\n\nAvailable skills:\n${list}`;
|
|
44717
|
+
}
|
|
44718
|
+
/** Dynamic parameters with enum constraint */
|
|
44719
|
+
get parameters() {
|
|
44720
|
+
const skillNames = (global.skillService?.getAllMetadata()?.filter((s) => s.enabled) || []).map((s) => s.name);
|
|
44721
|
+
return {
|
|
44722
|
+
type: "object",
|
|
44723
|
+
properties: {
|
|
44724
|
+
name: {
|
|
44725
|
+
type: "string",
|
|
44726
|
+
...(skillNames.length > 0 ? { enum: skillNames } : {}),
|
|
44727
|
+
description: "Name of the skill to activate",
|
|
44728
|
+
},
|
|
44729
|
+
},
|
|
44730
|
+
required: ["name"],
|
|
44731
|
+
};
|
|
44732
|
+
}
|
|
44733
|
+
async execute(args) {
|
|
44734
|
+
const name = args.name;
|
|
44735
|
+
if (!global.skillService) {
|
|
44736
|
+
return {
|
|
44737
|
+
content: [{ type: "text", text: "Skill service not available" }],
|
|
44738
|
+
isError: true,
|
|
44739
|
+
};
|
|
44740
|
+
}
|
|
44741
|
+
const skill = await global.skillService.loadSkill(name);
|
|
44742
|
+
if (!skill) {
|
|
44743
|
+
return {
|
|
44744
|
+
content: [{ type: "text", text: `Skill "${name}" not found` }],
|
|
44745
|
+
isError: true,
|
|
44746
|
+
};
|
|
44747
|
+
}
|
|
44748
|
+
const output = [
|
|
44749
|
+
`<activated_skill name="${skill.metadata.name}">`,
|
|
44750
|
+
`<instructions>`,
|
|
44751
|
+
skill.instructions.trim(),
|
|
44752
|
+
`</instructions>`,
|
|
44753
|
+
];
|
|
44754
|
+
if (skill.resources.length > 0) {
|
|
44755
|
+
output.push(`<available_resources base="${skill.basePath}">`);
|
|
44756
|
+
skill.resources.forEach((r) => output.push(` <file>${r}</file>`));
|
|
44757
|
+
output.push(`</available_resources>`);
|
|
44758
|
+
}
|
|
44759
|
+
output.push(`</activated_skill>`);
|
|
44760
|
+
return { content: [{ type: "text", text: output.join("\n") }] };
|
|
44761
|
+
}
|
|
44762
|
+
}
|
|
44763
|
+
|
|
44693
44764
|
const CHAT_SYSTEM_TEMPLATE = `
|
|
44694
44765
|
You are {{name}}, it is an action-oriented assistant in the browser, a general-purpose intelligent agent running in the browser environment.
|
|
44695
44766
|
|
|
@@ -44700,20 +44771,31 @@ General Principles:
|
|
|
44700
44771
|
- 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.
|
|
44701
44772
|
|
|
44702
44773
|
For non-chat related tasks issued by users, the following tools need to be called to complete them:
|
|
44703
|
-
<if ${TOOL_NAME$
|
|
44704
|
-
- ${TOOL_NAME$
|
|
44774
|
+
<if ${TOOL_NAME$2}Tool>
|
|
44775
|
+
- ${TOOL_NAME$2}: This tool is used to execute tasks, delegate to Javis AI assistant with full computer control.
|
|
44776
|
+
</if>
|
|
44777
|
+
<if ${TOOL_NAME$4}Tool>
|
|
44778
|
+
- ${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.
|
|
44705
44779
|
</if>
|
|
44706
44780
|
<if ${TOOL_NAME$3}Tool>
|
|
44707
|
-
- ${TOOL_NAME$3}:
|
|
44781
|
+
- ${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.
|
|
44708
44782
|
</if>
|
|
44709
|
-
<if ${TOOL_NAME$
|
|
44710
|
-
- ${TOOL_NAME$
|
|
44783
|
+
<if ${TOOL_NAME$1}Tool>
|
|
44784
|
+
- ${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.
|
|
44711
44785
|
</if>
|
|
44712
44786
|
<if ${TOOL_NAME}Tool>
|
|
44713
|
-
- ${TOOL_NAME}:
|
|
44787
|
+
- ${TOOL_NAME}: Activate a specialized skill for domain-specific tasks. Use when the user's request matches an available skill.
|
|
44714
44788
|
</if>
|
|
44715
44789
|
</tool_instructions>
|
|
44716
44790
|
|
|
44791
|
+
<if skills>
|
|
44792
|
+
## Available Skills
|
|
44793
|
+
You have access to specialized skills. Use activate_skill when the user's request matches a skill.
|
|
44794
|
+
<available_skills>
|
|
44795
|
+
{{skills}}
|
|
44796
|
+
</available_skills>
|
|
44797
|
+
</if>
|
|
44798
|
+
|
|
44717
44799
|
<if memory>
|
|
44718
44800
|
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.
|
|
44719
44801
|
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.
|
|
@@ -44733,7 +44815,7 @@ The information about the browser tabs currently open by the user is as follows:
|
|
|
44733
44815
|
Current datetime: {{datetime}}
|
|
44734
44816
|
The output language should match the user's conversation language.
|
|
44735
44817
|
`;
|
|
44736
|
-
function getChatSystemPrompt(tools, datetime, memory, tabs) {
|
|
44818
|
+
function getChatSystemPrompt(tools, datetime, memory, tabs, skills) {
|
|
44737
44819
|
const systemPrompt = global.prompts.get(GlobalPromptKey.chat_system) || CHAT_SYSTEM_TEMPLATE;
|
|
44738
44820
|
const toolVars = {};
|
|
44739
44821
|
for (let i = 0; i < tools.length; i++) {
|
|
@@ -44744,6 +44826,7 @@ function getChatSystemPrompt(tools, datetime, memory, tabs) {
|
|
|
44744
44826
|
datetime: datetime,
|
|
44745
44827
|
memory: memory || "",
|
|
44746
44828
|
tabs: getTabsInfo(tabs),
|
|
44829
|
+
skills: skills || "",
|
|
44747
44830
|
...toolVars,
|
|
44748
44831
|
}).trim();
|
|
44749
44832
|
}
|
|
@@ -44865,8 +44948,15 @@ class ChatAgent {
|
|
|
44865
44948
|
Log.error("browser service load tabs error: ", e);
|
|
44866
44949
|
}
|
|
44867
44950
|
}
|
|
44951
|
+
let _skills;
|
|
44952
|
+
if (global.skillService) {
|
|
44953
|
+
const skills = global.skillService.getAllMetadata().filter((s) => s.enabled);
|
|
44954
|
+
if (skills.length > 0) {
|
|
44955
|
+
_skills = skills.map((s) => `- ${s.name}: ${s.description}`).join("\n");
|
|
44956
|
+
}
|
|
44957
|
+
}
|
|
44868
44958
|
const datetime = params.datetime || new Date().toLocaleString();
|
|
44869
|
-
const systemPrompt = getChatSystemPrompt(chatTools, datetime, _memory, _tabs);
|
|
44959
|
+
const systemPrompt = getChatSystemPrompt(chatTools, datetime, _memory, _tabs, _skills);
|
|
44870
44960
|
this.memory.setSystemPrompt(systemPrompt);
|
|
44871
44961
|
}
|
|
44872
44962
|
async addUserMessage(messageId, user) {
|
|
@@ -44893,9 +44983,13 @@ class ChatAgent {
|
|
|
44893
44983
|
}
|
|
44894
44984
|
tools.push(new WebSearchTool(this.chatContext, params));
|
|
44895
44985
|
tools.push(new TaskVariableStorageTool(this.chatContext, params));
|
|
44896
|
-
//
|
|
44897
|
-
|
|
44898
|
-
|
|
44986
|
+
// Add skill tool when service available and has enabled skills
|
|
44987
|
+
if (global.skillService) {
|
|
44988
|
+
const skills = global.skillService.getAllMetadata().filter((s) => s.enabled);
|
|
44989
|
+
if (skills.length > 0) {
|
|
44990
|
+
tools.push(new ActivateSkillTool());
|
|
44991
|
+
}
|
|
44992
|
+
}
|
|
44899
44993
|
return tools;
|
|
44900
44994
|
}
|
|
44901
44995
|
getMemory() {
|
|
@@ -45150,5 +45244,5 @@ class AgentWrapTool {
|
|
|
45150
45244
|
}
|
|
45151
45245
|
}
|
|
45152
45246
|
|
|
45153
|
-
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 };
|
|
45247
|
+
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 };
|
|
45154
45248
|
//# sourceMappingURL=index.esm.js.map
|