@jarvis-agent/core 0.2.5 → 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/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 +136 -47
- 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 +136 -48
- 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/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
|
@@ -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,EACvB,4BAA4B,EAC5B,2BAA2B,EAE5B,MAAM,UAAU,CAAC;AASlB,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAU7C,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;cA+CA,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,EAAE,cAAc,GAAG,YAAY,EAAE;IAoB1D,SAAS,IAAI,SAAS;IAItB,QAAQ,IAAI,YAAY,EAAE;IAI1B,cAAc,IAAI,WAAW;cAIpB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,YAAY,EAAE,EACzB,OAAO,EAAE,KAAK,CAAC,uBAAuB,GAAG,4BAA4B,GAAG,2BAA2B,CAAC,EACpG,kBAAkB,CAAC,EAAE,kBAAkB,GACtC,OAAO,CAAC,MAAM,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,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$
|
|
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,10 +40177,10 @@ class McpTool {
|
|
|
40177
40177
|
}
|
|
40178
40178
|
}
|
|
40179
40179
|
|
|
40180
|
-
const TOOL_NAME$
|
|
40180
|
+
const TOOL_NAME$6 = "task_result_check";
|
|
40181
40181
|
class TaskResultCheckTool {
|
|
40182
40182
|
constructor() {
|
|
40183
|
-
this.name = TOOL_NAME$
|
|
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$
|
|
40287
|
+
const TOOL_NAME$5 = "todo_list_manager";
|
|
40288
40288
|
class TodoListManagerTool {
|
|
40289
40289
|
constructor() {
|
|
40290
|
-
this.name = TOOL_NAME$
|
|
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$
|
|
40422
|
+
<if ${TOOL_NAME$9}Tool>
|
|
40423
40423
|
* HUMAN INTERACT
|
|
40424
|
-
During the task execution process, you can use the \`${TOOL_NAME$
|
|
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$
|
|
40428
|
-
- The \`${TOOL_NAME$
|
|
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$
|
|
40430
|
+
<if ${TOOL_NAME$7}Tool>
|
|
40431
40431
|
* VARIABLE STORAGE
|
|
40432
|
-
When a step node has input/output variable attributes, use the \`${TOOL_NAME$
|
|
40433
|
-
The \`${TOOL_NAME$
|
|
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$
|
|
40435
|
+
<if ${TOOL_NAME$b}Tool>
|
|
40436
40436
|
* forEach node
|
|
40437
|
-
For repetitive tasks, when executing a forEach node, the \`${TOOL_NAME$
|
|
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$
|
|
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$
|
|
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$
|
|
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) {
|
|
@@ -44279,7 +44279,7 @@ class ChatContext {
|
|
|
44279
44279
|
}
|
|
44280
44280
|
}
|
|
44281
44281
|
|
|
44282
|
-
const TOOL_NAME$
|
|
44282
|
+
const TOOL_NAME$4 = "webpageQa";
|
|
44283
44283
|
const WEBPAGE_QA_PROMPT = `
|
|
44284
44284
|
You are a helpful assistant that can answer questions based on the provided webpage context.
|
|
44285
44285
|
|
|
@@ -44300,7 +44300,7 @@ Answer user's question based on the webpage context, the answer should be in the
|
|
|
44300
44300
|
`;
|
|
44301
44301
|
class WebpageQaTool {
|
|
44302
44302
|
constructor(chatContext, params) {
|
|
44303
|
-
this.name = TOOL_NAME$
|
|
44303
|
+
this.name = TOOL_NAME$4;
|
|
44304
44304
|
this.params = params;
|
|
44305
44305
|
this.chatContext = chatContext;
|
|
44306
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.`;
|
|
@@ -44416,10 +44416,10 @@ class WebpageQaTool {
|
|
|
44416
44416
|
}
|
|
44417
44417
|
}
|
|
44418
44418
|
|
|
44419
|
-
const TOOL_NAME$
|
|
44419
|
+
const TOOL_NAME$3 = "webSearch";
|
|
44420
44420
|
class WebSearchTool {
|
|
44421
44421
|
constructor(chatContext, params) {
|
|
44422
|
-
this.name = TOOL_NAME$
|
|
44422
|
+
this.name = TOOL_NAME$3;
|
|
44423
44423
|
this.params = params;
|
|
44424
44424
|
this.chatContext = chatContext;
|
|
44425
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.`;
|
|
@@ -44489,12 +44489,12 @@ async function recursiveTextNode(node, callback) {
|
|
|
44489
44489
|
}
|
|
44490
44490
|
}
|
|
44491
44491
|
|
|
44492
|
-
const TOOL_NAME$
|
|
44492
|
+
const TOOL_NAME$2 = "deepAction";
|
|
44493
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.";
|
|
44494
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.";
|
|
44495
44495
|
class DeepActionTool {
|
|
44496
44496
|
constructor(chatContext, params) {
|
|
44497
|
-
this.name = TOOL_NAME$
|
|
44497
|
+
this.name = TOOL_NAME$2;
|
|
44498
44498
|
this.chatContext = chatContext;
|
|
44499
44499
|
const agents = this.chatContext.getConfig().agents || [];
|
|
44500
44500
|
const agentNames = agents.map((agent) => agent.Name).join(", ");
|
|
@@ -44651,10 +44651,10 @@ class DeepActionTool {
|
|
|
44651
44651
|
}
|
|
44652
44652
|
}
|
|
44653
44653
|
|
|
44654
|
-
const TOOL_NAME = "taskVariableStorage";
|
|
44654
|
+
const TOOL_NAME$1 = "taskVariableStorage";
|
|
44655
44655
|
class TaskVariableStorageTool {
|
|
44656
44656
|
constructor(chatContext, params) {
|
|
44657
|
-
this.name = TOOL_NAME;
|
|
44657
|
+
this.name = TOOL_NAME$1;
|
|
44658
44658
|
this.params = params;
|
|
44659
44659
|
this.chatContext = chatContext;
|
|
44660
44660
|
this.description = `Used for storing, reading, and retrieving variable data, and maintaining input/output variables in task nodes.`;
|
|
@@ -44731,6 +44731,71 @@ class TaskVariableStorageTool {
|
|
|
44731
44731
|
}
|
|
44732
44732
|
}
|
|
44733
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
|
+
|
|
44734
44799
|
const CHAT_SYSTEM_TEMPLATE = `
|
|
44735
44800
|
You are {{name}}, it is an action-oriented assistant in the browser, a general-purpose intelligent agent running in the browser environment.
|
|
44736
44801
|
|
|
@@ -44741,20 +44806,31 @@ General Principles:
|
|
|
44741
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.
|
|
44742
44807
|
|
|
44743
44808
|
For non-chat related tasks issued by users, the following tools need to be called to complete them:
|
|
44744
|
-
<if ${TOOL_NAME$
|
|
44745
|
-
- ${TOOL_NAME$
|
|
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.
|
|
44746
44814
|
</if>
|
|
44747
44815
|
<if ${TOOL_NAME$3}Tool>
|
|
44748
|
-
- ${TOOL_NAME$3}:
|
|
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.
|
|
44749
44817
|
</if>
|
|
44750
|
-
<if ${TOOL_NAME$
|
|
44751
|
-
- ${TOOL_NAME$
|
|
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.
|
|
44752
44820
|
</if>
|
|
44753
44821
|
<if ${TOOL_NAME}Tool>
|
|
44754
|
-
- ${TOOL_NAME}:
|
|
44822
|
+
- ${TOOL_NAME}: Activate a specialized skill for domain-specific tasks. Use when the user's request matches an available skill.
|
|
44755
44823
|
</if>
|
|
44756
44824
|
</tool_instructions>
|
|
44757
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
|
+
|
|
44758
44834
|
<if memory>
|
|
44759
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.
|
|
44760
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.
|
|
@@ -44774,7 +44850,7 @@ The information about the browser tabs currently open by the user is as follows:
|
|
|
44774
44850
|
Current datetime: {{datetime}}
|
|
44775
44851
|
The output language should match the user's conversation language.
|
|
44776
44852
|
`;
|
|
44777
|
-
function getChatSystemPrompt(tools, datetime, memory, tabs) {
|
|
44853
|
+
function getChatSystemPrompt(tools, datetime, memory, tabs, skills) {
|
|
44778
44854
|
const systemPrompt = global.prompts.get(exports.GlobalPromptKey.chat_system) || CHAT_SYSTEM_TEMPLATE;
|
|
44779
44855
|
const toolVars = {};
|
|
44780
44856
|
for (let i = 0; i < tools.length; i++) {
|
|
@@ -44785,6 +44861,7 @@ function getChatSystemPrompt(tools, datetime, memory, tabs) {
|
|
|
44785
44861
|
datetime: datetime,
|
|
44786
44862
|
memory: memory || "",
|
|
44787
44863
|
tabs: getTabsInfo(tabs),
|
|
44864
|
+
skills: skills || "",
|
|
44788
44865
|
...toolVars,
|
|
44789
44866
|
}).trim();
|
|
44790
44867
|
}
|
|
@@ -44906,8 +44983,15 @@ class ChatAgent {
|
|
|
44906
44983
|
Log.error("browser service load tabs error: ", e);
|
|
44907
44984
|
}
|
|
44908
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
|
+
}
|
|
44909
44993
|
const datetime = params.datetime || new Date().toLocaleString();
|
|
44910
|
-
const systemPrompt = getChatSystemPrompt(chatTools, datetime, _memory, _tabs);
|
|
44994
|
+
const systemPrompt = getChatSystemPrompt(chatTools, datetime, _memory, _tabs, _skills);
|
|
44911
44995
|
this.memory.setSystemPrompt(systemPrompt);
|
|
44912
44996
|
}
|
|
44913
44997
|
async addUserMessage(messageId, user) {
|
|
@@ -44934,9 +45018,13 @@ class ChatAgent {
|
|
|
44934
45018
|
}
|
|
44935
45019
|
tools.push(new WebSearchTool(this.chatContext, params));
|
|
44936
45020
|
tools.push(new TaskVariableStorageTool(this.chatContext, params));
|
|
44937
|
-
//
|
|
44938
|
-
|
|
44939
|
-
|
|
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
|
+
}
|
|
44940
45028
|
return tools;
|
|
44941
45029
|
}
|
|
44942
45030
|
getMemory() {
|
|
@@ -45191,6 +45279,7 @@ class AgentWrapTool {
|
|
|
45191
45279
|
}
|
|
45192
45280
|
}
|
|
45193
45281
|
|
|
45282
|
+
exports.ActivateSkillTool = ActivateSkillTool;
|
|
45194
45283
|
exports.Agent = Agent;
|
|
45195
45284
|
exports.AgentChain = AgentChain;
|
|
45196
45285
|
exports.AgentContext = AgentContext;
|