@jarvis-agent/core 0.1.9 → 0.2.1
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/index.cjs +187 -3
- 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 +187 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/agent/browser/browser_base.d.ts +0 -52
- package/dist/agent/browser/browser_base.d.ts.map +0 -1
- package/dist/agent/browser/browser_labels.d.ts +0 -28
- package/dist/agent/browser/browser_labels.d.ts.map +0 -1
- package/dist/agent/browser/browser_screen.d.ts +0 -17
- package/dist/agent/browser/browser_screen.d.ts.map +0 -1
- package/dist/agent/browser/build_dom_tree.d.ts +0 -2
- package/dist/agent/browser/build_dom_tree.d.ts.map +0 -1
- package/dist/agent/computer.d.ts +0 -23
- package/dist/agent/computer.d.ts.map +0 -1
- package/dist/agent/llm.d.ts +0 -13
- package/dist/agent/llm.d.ts.map +0 -1
- package/dist/agent/shell.d.ts +0 -15
- package/dist/agent/shell.d.ts.map +0 -1
- package/dist/core/chain.d.ts +0 -45
- package/dist/core/chain.d.ts.map +0 -1
- package/dist/core/context.d.ts +0 -31
- package/dist/core/context.d.ts.map +0 -1
- package/dist/core/dialogue/execute_task.d.ts +0 -15
- package/dist/core/dialogue/execute_task.d.ts.map +0 -1
- package/dist/core/dialogue/llm.d.ts +0 -8
- package/dist/core/dialogue/llm.d.ts.map +0 -1
- package/dist/core/dialogue/task_planner.d.ts +0 -15
- package/dist/core/dialogue/task_planner.d.ts.map +0 -1
- package/dist/core/dialogue/variable_storage.d.ts +0 -14
- package/dist/core/dialogue/variable_storage.d.ts.map +0 -1
- package/dist/core/dialogue.d.ts +0 -22
- package/dist/core/dialogue.d.ts.map +0 -1
- package/dist/core/eko.d.ts +0 -25
- package/dist/core/eko.d.ts.map +0 -1
- package/dist/core/index.d.ts +0 -5
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/plan.d.ts +0 -13
- package/dist/core/plan.d.ts.map +0 -1
- package/dist/core/replan.d.ts +0 -4
- package/dist/core/replan.d.ts.map +0 -1
- package/dist/index.cjs.js +0 -37132
- package/dist/index.cjs.js.map +0 -1
- package/dist/prompt/dialogue.d.ts +0 -2
- package/dist/prompt/dialogue.d.ts.map +0 -1
- package/dist/tools/foreach_task.d.ts +0 -13
- package/dist/tools/foreach_task.d.ts.map +0 -1
- package/dist/tools/human_interact.d.ts +0 -15
- package/dist/tools/human_interact.d.ts.map +0 -1
- package/dist/tools/task_node_status.d.ts +0 -13
- package/dist/tools/task_node_status.d.ts.map +0 -1
- package/dist/tools/task_result_check.d.ts +0 -18
- package/dist/tools/task_result_check.d.ts.map +0 -1
- package/dist/tools/todo_list_manager.d.ts +0 -16
- package/dist/tools/todo_list_manager.d.ts.map +0 -1
- package/dist/tools/variable_storage.d.ts +0 -13
- package/dist/tools/variable_storage.d.ts.map +0 -1
- package/dist/tools/watch_trigger.d.ts +0 -17
- package/dist/tools/watch_trigger.d.ts.map +0 -1
- package/dist/types/core.types.d.ts +0 -163
- package/dist/types/core.types.d.ts.map +0 -1
- package/dist/types/dialogue.types.d.ts +0 -108
- package/dist/types/dialogue.types.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -42377,7 +42377,7 @@ function mark_screenshot_highlight_elements(screenshot, area_map, client_rect) {
|
|
|
42377
42377
|
});
|
|
42378
42378
|
}
|
|
42379
42379
|
|
|
42380
|
-
const AGENT_NAME = "Browser";
|
|
42380
|
+
const AGENT_NAME$1 = "Browser";
|
|
42381
42381
|
class BaseBrowserAgent extends Agent {
|
|
42382
42382
|
async go_back(agentContext) {
|
|
42383
42383
|
try {
|
|
@@ -43262,7 +43262,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
43262
43262
|
}
|
|
43263
43263
|
const initTools = [];
|
|
43264
43264
|
super({
|
|
43265
|
-
name: AGENT_NAME,
|
|
43265
|
+
name: AGENT_NAME$1,
|
|
43266
43266
|
description: description,
|
|
43267
43267
|
tools: initTools,
|
|
43268
43268
|
llms: llms,
|
|
@@ -44029,7 +44029,7 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
|
|
|
44029
44029
|
- YOU CAN DO ANYTHING ON THE BROWSER - including clicking on elements, filling forms, submitting data, etc.`;
|
|
44030
44030
|
const initTools = [];
|
|
44031
44031
|
super({
|
|
44032
|
-
name: AGENT_NAME,
|
|
44032
|
+
name: AGENT_NAME$1,
|
|
44033
44033
|
description: description,
|
|
44034
44034
|
tools: initTools,
|
|
44035
44035
|
llms: llms,
|
|
@@ -44317,6 +44317,189 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
|
|
|
44317
44317
|
}
|
|
44318
44318
|
}
|
|
44319
44319
|
|
|
44320
|
+
const AGENT_NAME = "File";
|
|
44321
|
+
class BaseFileAgent extends Agent {
|
|
44322
|
+
constructor(work_path, llms, ext_tools, mcpClients, planDescription) {
|
|
44323
|
+
const initTools = [];
|
|
44324
|
+
const prompt = work_path
|
|
44325
|
+
? `Your working directory is: ${work_path}
|
|
44326
|
+
- When viewing file lists and outputting file paths, always include the working directory
|
|
44327
|
+
- When outputting files, there is no need to verify if the working path exists; the working path will be automatically created when writing files
|
|
44328
|
+
- Output file names must be in English
|
|
44329
|
+
- IMPORTANT: In your final summary, describe ONLY what was accomplished. NEVER include file paths, file names, or file locations. Do not verify or mention file existence
|
|
44330
|
+
- For data-related content, combine with visualization tools for display
|
|
44331
|
+
- For visualizations, generate charts first before page generation to minimize repetitive work`
|
|
44332
|
+
: "";
|
|
44333
|
+
super({
|
|
44334
|
+
name: AGENT_NAME,
|
|
44335
|
+
description: `You are a file agent, handling file-related tasks such as creating, finding, reading, modifying files, etc.${prompt}`,
|
|
44336
|
+
tools: initTools,
|
|
44337
|
+
llms: llms,
|
|
44338
|
+
mcpClients: Array.isArray(mcpClients) ? mcpClients : (mcpClients ? [mcpClients] : []),
|
|
44339
|
+
planDescription: planDescription ||
|
|
44340
|
+
`File operation agent, handles file-related tasks such as creating, finding, reading, modifying files, etc. Only supports text file output
|
|
44341
|
+
- Output file names must be in English
|
|
44342
|
+
- When users request poster or summary file output, only output txt or html files, no need to verify existence or accessibility at the end
|
|
44343
|
+
- For data-related content, combine with visualization tools for display
|
|
44344
|
+
- For visualizations, generate charts first before page generation to minimize repetitive work`,
|
|
44345
|
+
});
|
|
44346
|
+
let builtTools = this.buildInitTools();
|
|
44347
|
+
if (ext_tools && ext_tools.length > 0) {
|
|
44348
|
+
builtTools = mergeTools(builtTools, ext_tools);
|
|
44349
|
+
}
|
|
44350
|
+
builtTools.forEach((tool) => initTools.push(tool));
|
|
44351
|
+
}
|
|
44352
|
+
async do_file_read(agentContext, path, write_variable) {
|
|
44353
|
+
let file_context = await this.file_read(agentContext, path);
|
|
44354
|
+
if (file_context && file_context.length > exports.config.fileTextMaxLength) {
|
|
44355
|
+
file_context = sub(file_context, exports.config.fileTextMaxLength, true);
|
|
44356
|
+
}
|
|
44357
|
+
if (write_variable) {
|
|
44358
|
+
agentContext.context.variables.set(write_variable, file_context);
|
|
44359
|
+
}
|
|
44360
|
+
return {
|
|
44361
|
+
file_context: file_context,
|
|
44362
|
+
write_variable: write_variable,
|
|
44363
|
+
};
|
|
44364
|
+
}
|
|
44365
|
+
async do_file_write(agentContext, path, append, content, from_variable) {
|
|
44366
|
+
if (content == null && from_variable == null) {
|
|
44367
|
+
throw new Error(`content and from_variable cannot be both empty, cannot write to file ${path}`);
|
|
44368
|
+
}
|
|
44369
|
+
if (from_variable) {
|
|
44370
|
+
let variable_value = agentContext.context.variables.get(from_variable) || "";
|
|
44371
|
+
if (variable_value) {
|
|
44372
|
+
content = variable_value;
|
|
44373
|
+
}
|
|
44374
|
+
if (!content) {
|
|
44375
|
+
throw new Error(`Variable ${from_variable} is empty, cannot write to file ${path}`);
|
|
44376
|
+
}
|
|
44377
|
+
}
|
|
44378
|
+
if (!content) {
|
|
44379
|
+
throw new Error(`content is empty, cannot write to file ${path}`);
|
|
44380
|
+
}
|
|
44381
|
+
return await this.file_write(agentContext, path, content || "", append);
|
|
44382
|
+
}
|
|
44383
|
+
buildInitTools() {
|
|
44384
|
+
return [
|
|
44385
|
+
{
|
|
44386
|
+
name: "file_list",
|
|
44387
|
+
description: "Getting a list of files in a specified directory.",
|
|
44388
|
+
parameters: {
|
|
44389
|
+
type: "object",
|
|
44390
|
+
properties: {
|
|
44391
|
+
path: {
|
|
44392
|
+
type: "string",
|
|
44393
|
+
description: "File directory path",
|
|
44394
|
+
},
|
|
44395
|
+
},
|
|
44396
|
+
required: ["path"],
|
|
44397
|
+
},
|
|
44398
|
+
execute: async (args, agentContext) => {
|
|
44399
|
+
return await this.callInnerTool(() => this.file_list(agentContext, args.path));
|
|
44400
|
+
},
|
|
44401
|
+
},
|
|
44402
|
+
{
|
|
44403
|
+
name: "file_read",
|
|
44404
|
+
description: "Read file content. Use to read files or check file content.",
|
|
44405
|
+
parameters: {
|
|
44406
|
+
type: "object",
|
|
44407
|
+
properties: {
|
|
44408
|
+
path: {
|
|
44409
|
+
type: "string",
|
|
44410
|
+
description: "File path",
|
|
44411
|
+
},
|
|
44412
|
+
write_variable: {
|
|
44413
|
+
type: "string",
|
|
44414
|
+
description: "Variable name, the content after reading is simultaneously written to the variable, facilitating direct loading from the variable in subsequent operations.",
|
|
44415
|
+
},
|
|
44416
|
+
},
|
|
44417
|
+
required: ["path"],
|
|
44418
|
+
},
|
|
44419
|
+
execute: async (args, agentContext) => {
|
|
44420
|
+
return await this.callInnerTool(() => this.do_file_read(agentContext, args.path, args.write_variable));
|
|
44421
|
+
},
|
|
44422
|
+
},
|
|
44423
|
+
{
|
|
44424
|
+
name: "file_write",
|
|
44425
|
+
description: "Overwrite or append content to a file. Use for creating new files, appending content, or modifying existing files, only supports txt/md/json/csv or other text formats.",
|
|
44426
|
+
parameters: {
|
|
44427
|
+
type: "object",
|
|
44428
|
+
properties: {
|
|
44429
|
+
path: {
|
|
44430
|
+
type: "string",
|
|
44431
|
+
description: "File path",
|
|
44432
|
+
},
|
|
44433
|
+
append: {
|
|
44434
|
+
type: "boolean",
|
|
44435
|
+
description: "(Optional) Whether to use append mode",
|
|
44436
|
+
default: false,
|
|
44437
|
+
},
|
|
44438
|
+
content: {
|
|
44439
|
+
type: "string",
|
|
44440
|
+
description: "Text content, write content directly to the file.",
|
|
44441
|
+
},
|
|
44442
|
+
from_variable: {
|
|
44443
|
+
type: "string",
|
|
44444
|
+
description: "Variable name, read content from the variable and write it.",
|
|
44445
|
+
},
|
|
44446
|
+
},
|
|
44447
|
+
required: ["path"],
|
|
44448
|
+
},
|
|
44449
|
+
execute: async (args, agentContext) => {
|
|
44450
|
+
return await this.callInnerTool(() => this.do_file_write(agentContext, args.path, (args.append || false), args.content, args.from_variable));
|
|
44451
|
+
},
|
|
44452
|
+
},
|
|
44453
|
+
{
|
|
44454
|
+
name: "file_str_replace",
|
|
44455
|
+
description: "Replace specified string in a file. Use for updating specific content in files.",
|
|
44456
|
+
parameters: {
|
|
44457
|
+
type: "object",
|
|
44458
|
+
properties: {
|
|
44459
|
+
path: {
|
|
44460
|
+
type: "string",
|
|
44461
|
+
description: "File path",
|
|
44462
|
+
},
|
|
44463
|
+
old_str: {
|
|
44464
|
+
type: "string",
|
|
44465
|
+
description: "Original string to be replaced",
|
|
44466
|
+
},
|
|
44467
|
+
new_str: {
|
|
44468
|
+
type: "string",
|
|
44469
|
+
description: "New string to replace with",
|
|
44470
|
+
},
|
|
44471
|
+
},
|
|
44472
|
+
required: ["path", "old_str", "new_str"],
|
|
44473
|
+
},
|
|
44474
|
+
execute: async (args, agentContext) => {
|
|
44475
|
+
return await this.callInnerTool(() => this.file_str_replace(agentContext, args.path, args.old_str, args.new_str));
|
|
44476
|
+
},
|
|
44477
|
+
},
|
|
44478
|
+
{
|
|
44479
|
+
name: "file_find_by_name",
|
|
44480
|
+
description: "Find files by name pattern in specified directory. Use for locating files with specific naming patterns.",
|
|
44481
|
+
parameters: {
|
|
44482
|
+
type: "object",
|
|
44483
|
+
properties: {
|
|
44484
|
+
path: {
|
|
44485
|
+
type: "string",
|
|
44486
|
+
description: "Absolute path of directory to search",
|
|
44487
|
+
},
|
|
44488
|
+
glob: {
|
|
44489
|
+
type: "string",
|
|
44490
|
+
description: "Filename pattern using glob syntax wildcards, Example: **/*.txt",
|
|
44491
|
+
},
|
|
44492
|
+
},
|
|
44493
|
+
required: ["path", "glob"],
|
|
44494
|
+
},
|
|
44495
|
+
execute: async (args, agentContext) => {
|
|
44496
|
+
return await this.callInnerTool(() => this.file_find_by_name(agentContext, args.path, args.glob));
|
|
44497
|
+
},
|
|
44498
|
+
},
|
|
44499
|
+
];
|
|
44500
|
+
}
|
|
44501
|
+
}
|
|
44502
|
+
|
|
44320
44503
|
class EkoMemory {
|
|
44321
44504
|
constructor(systemPrompt, messages = [], memoryConfig = exports.config.memoryConfig) {
|
|
44322
44505
|
this.messages = messages;
|
|
@@ -46063,6 +46246,7 @@ exports.AgentWrapTool = AgentWrapTool;
|
|
|
46063
46246
|
exports.BaseBrowserAgent = BaseBrowserAgent;
|
|
46064
46247
|
exports.BaseBrowserLabelsAgent = BaseBrowserLabelsAgent;
|
|
46065
46248
|
exports.BaseBrowserScreenAgent = BaseBrowserScreenAgent;
|
|
46249
|
+
exports.BaseFileAgent = BaseFileAgent;
|
|
46066
46250
|
exports.Chain = Chain;
|
|
46067
46251
|
exports.ChatAgent = ChatAgent;
|
|
46068
46252
|
exports.ChatContext = ChatContext;
|