@nodetool-ai/agents 0.7.0-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-executor.d.ts +62 -0
- package/dist/agent-executor.d.ts.map +1 -0
- package/dist/agent-executor.js +324 -0
- package/dist/agent-executor.js.map +1 -0
- package/dist/agent-step-executor.d.ts +28 -0
- package/dist/agent-step-executor.d.ts.map +1 -0
- package/dist/agent-step-executor.js +99 -0
- package/dist/agent-step-executor.js.map +1 -0
- package/dist/agent-workflow-runner.d.ts +31 -0
- package/dist/agent-workflow-runner.d.ts.map +1 -0
- package/dist/agent-workflow-runner.js +124 -0
- package/dist/agent-workflow-runner.js.map +1 -0
- package/dist/agent.d.ts +115 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +587 -0
- package/dist/agent.js.map +1 -0
- package/dist/base-agent.d.ts +42 -0
- package/dist/base-agent.d.ts.map +1 -0
- package/dist/base-agent.js +29 -0
- package/dist/base-agent.js.map +1 -0
- package/dist/constants.d.ts +8 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +8 -0
- package/dist/constants.js.map +1 -0
- package/dist/graph-builder.d.ts +49 -0
- package/dist/graph-builder.d.ts.map +1 -0
- package/dist/graph-builder.js +206 -0
- package/dist/graph-builder.js.map +1 -0
- package/dist/graph-planner.d.ts +56 -0
- package/dist/graph-planner.d.ts.map +1 -0
- package/dist/graph-planner.js +311 -0
- package/dist/graph-planner.js.map +1 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +81 -0
- package/dist/index.js.map +1 -0
- package/dist/js-sandbox.d.ts +84 -0
- package/dist/js-sandbox.d.ts.map +1 -0
- package/dist/js-sandbox.js +654 -0
- package/dist/js-sandbox.js.map +1 -0
- package/dist/multi-mode-agent.d.ts +86 -0
- package/dist/multi-mode-agent.d.ts.map +1 -0
- package/dist/multi-mode-agent.js +476 -0
- package/dist/multi-mode-agent.js.map +1 -0
- package/dist/output-format.d.ts +10 -0
- package/dist/output-format.d.ts.map +1 -0
- package/dist/output-format.js +17 -0
- package/dist/output-format.js.map +1 -0
- package/dist/parallel-task-executor.d.ts +87 -0
- package/dist/parallel-task-executor.d.ts.map +1 -0
- package/dist/parallel-task-executor.js +332 -0
- package/dist/parallel-task-executor.js.map +1 -0
- package/dist/prompts/graph-planner-prompt.d.ts +48 -0
- package/dist/prompts/graph-planner-prompt.d.ts.map +1 -0
- package/dist/prompts/graph-planner-prompt.js +180 -0
- package/dist/prompts/graph-planner-prompt.js.map +1 -0
- package/dist/reject-agentic-provider.d.ts +21 -0
- package/dist/reject-agentic-provider.d.ts.map +1 -0
- package/dist/reject-agentic-provider.js +32 -0
- package/dist/reject-agentic-provider.js.map +1 -0
- package/dist/simple-agent.d.ts +29 -0
- package/dist/simple-agent.d.ts.map +1 -0
- package/dist/simple-agent.js +54 -0
- package/dist/simple-agent.js.map +1 -0
- package/dist/step-executor.d.ts +162 -0
- package/dist/step-executor.d.ts.map +1 -0
- package/dist/step-executor.js +1114 -0
- package/dist/step-executor.js.map +1 -0
- package/dist/sub-agent-planner.d.ts +33 -0
- package/dist/sub-agent-planner.d.ts.map +1 -0
- package/dist/sub-agent-planner.js +203 -0
- package/dist/sub-agent-planner.js.map +1 -0
- package/dist/task-executor.d.ts +89 -0
- package/dist/task-executor.d.ts.map +1 -0
- package/dist/task-executor.js +359 -0
- package/dist/task-executor.js.map +1 -0
- package/dist/task-planner.d.ts +44 -0
- package/dist/task-planner.d.ts.map +1 -0
- package/dist/task-planner.js +532 -0
- package/dist/task-planner.js.map +1 -0
- package/dist/team/db-task-board.d.ts +54 -0
- package/dist/team/db-task-board.d.ts.map +1 -0
- package/dist/team/db-task-board.js +361 -0
- package/dist/team/db-task-board.js.map +1 -0
- package/dist/team/edge-message-bus.d.ts +51 -0
- package/dist/team/edge-message-bus.d.ts.map +1 -0
- package/dist/team/edge-message-bus.js +169 -0
- package/dist/team/edge-message-bus.js.map +1 -0
- package/dist/team/edge-task-board.d.ts +77 -0
- package/dist/team/edge-task-board.d.ts.map +1 -0
- package/dist/team/edge-task-board.js +140 -0
- package/dist/team/edge-task-board.js.map +1 -0
- package/dist/team/index.d.ts +16 -0
- package/dist/team/index.d.ts.map +1 -0
- package/dist/team/index.js +17 -0
- package/dist/team/index.js.map +1 -0
- package/dist/team/message-bus.d.ts +58 -0
- package/dist/team/message-bus.d.ts.map +1 -0
- package/dist/team/message-bus.js +151 -0
- package/dist/team/message-bus.js.map +1 -0
- package/dist/team/task-board.d.ts +106 -0
- package/dist/team/task-board.d.ts.map +1 -0
- package/dist/team/task-board.js +370 -0
- package/dist/team/task-board.js.map +1 -0
- package/dist/team/team-executor.d.ts +72 -0
- package/dist/team/team-executor.d.ts.map +1 -0
- package/dist/team/team-executor.js +466 -0
- package/dist/team/team-executor.js.map +1 -0
- package/dist/team/team-tools.d.ts +252 -0
- package/dist/team/team-tools.d.ts.map +1 -0
- package/dist/team/team-tools.js +412 -0
- package/dist/team/team-tools.js.map +1 -0
- package/dist/team/types.d.ts +198 -0
- package/dist/team/types.d.ts.map +1 -0
- package/dist/team/types.js +8 -0
- package/dist/team/types.js.map +1 -0
- package/dist/tools/add-edge-tool.d.ts +18 -0
- package/dist/tools/add-edge-tool.d.ts.map +1 -0
- package/dist/tools/add-edge-tool.js +92 -0
- package/dist/tools/add-edge-tool.js.map +1 -0
- package/dist/tools/add-node-tool.d.ts +22 -0
- package/dist/tools/add-node-tool.d.ts.map +1 -0
- package/dist/tools/add-node-tool.js +128 -0
- package/dist/tools/add-node-tool.js.map +1 -0
- package/dist/tools/asset-tools.d.ts +58 -0
- package/dist/tools/asset-tools.d.ts.map +1 -0
- package/dist/tools/asset-tools.js +191 -0
- package/dist/tools/asset-tools.js.map +1 -0
- package/dist/tools/base-tool.d.ts +25 -0
- package/dist/tools/base-tool.d.ts.map +1 -0
- package/dist/tools/base-tool.js +24 -0
- package/dist/tools/base-tool.js.map +1 -0
- package/dist/tools/browser-tools.d.ts +32 -0
- package/dist/tools/browser-tools.d.ts.map +1 -0
- package/dist/tools/browser-tools.js +208 -0
- package/dist/tools/browser-tools.js.map +1 -0
- package/dist/tools/calculator-tool.d.ts +24 -0
- package/dist/tools/calculator-tool.d.ts.map +1 -0
- package/dist/tools/calculator-tool.js +64 -0
- package/dist/tools/calculator-tool.js.map +1 -0
- package/dist/tools/claude-code-tools.d.ts +96 -0
- package/dist/tools/claude-code-tools.d.ts.map +1 -0
- package/dist/tools/claude-code-tools.js +463 -0
- package/dist/tools/claude-code-tools.js.map +1 -0
- package/dist/tools/code-tools.d.ts +26 -0
- package/dist/tools/code-tools.d.ts.map +1 -0
- package/dist/tools/code-tools.js +82 -0
- package/dist/tools/code-tools.js.map +1 -0
- package/dist/tools/control-tool.d.ts +47 -0
- package/dist/tools/control-tool.d.ts.map +1 -0
- package/dist/tools/control-tool.js +101 -0
- package/dist/tools/control-tool.js.map +1 -0
- package/dist/tools/create-plan-tool.d.ts +29 -0
- package/dist/tools/create-plan-tool.d.ts.map +1 -0
- package/dist/tools/create-plan-tool.js +355 -0
- package/dist/tools/create-plan-tool.js.map +1 -0
- package/dist/tools/create-task-tool.d.ts +28 -0
- package/dist/tools/create-task-tool.d.ts.map +1 -0
- package/dist/tools/create-task-tool.js +254 -0
- package/dist/tools/create-task-tool.js.map +1 -0
- package/dist/tools/dataseo-tools.d.ts +38 -0
- package/dist/tools/dataseo-tools.d.ts.map +1 -0
- package/dist/tools/dataseo-tools.js +329 -0
- package/dist/tools/dataseo-tools.js.map +1 -0
- package/dist/tools/email-tools.d.ts +76 -0
- package/dist/tools/email-tools.d.ts.map +1 -0
- package/dist/tools/email-tools.js +259 -0
- package/dist/tools/email-tools.js.map +1 -0
- package/dist/tools/filesystem-tools.d.ts +77 -0
- package/dist/tools/filesystem-tools.d.ts.map +1 -0
- package/dist/tools/filesystem-tools.js +334 -0
- package/dist/tools/filesystem-tools.js.map +1 -0
- package/dist/tools/find-model-tool.d.ts +25 -0
- package/dist/tools/find-model-tool.d.ts.map +1 -0
- package/dist/tools/find-model-tool.js +236 -0
- package/dist/tools/find-model-tool.js.map +1 -0
- package/dist/tools/finish-graph-tool.d.ts +23 -0
- package/dist/tools/finish-graph-tool.d.ts.map +1 -0
- package/dist/tools/finish-graph-tool.js +46 -0
- package/dist/tools/finish-graph-tool.js.map +1 -0
- package/dist/tools/finish-step-tool.d.ts +16 -0
- package/dist/tools/finish-step-tool.d.ts.map +1 -0
- package/dist/tools/finish-step-tool.js +68 -0
- package/dist/tools/finish-step-tool.js.map +1 -0
- package/dist/tools/google-tools.d.ts +44 -0
- package/dist/tools/google-tools.d.ts.map +1 -0
- package/dist/tools/google-tools.js +176 -0
- package/dist/tools/google-tools.js.map +1 -0
- package/dist/tools/http-tools.d.ts +56 -0
- package/dist/tools/http-tools.d.ts.map +1 -0
- package/dist/tools/http-tools.js +180 -0
- package/dist/tools/http-tools.js.map +1 -0
- package/dist/tools/js-code-tool.d.ts +30 -0
- package/dist/tools/js-code-tool.d.ts.map +1 -0
- package/dist/tools/js-code-tool.js +98 -0
- package/dist/tools/js-code-tool.js.map +1 -0
- package/dist/tools/local-get-node-info-tool.d.ts +19 -0
- package/dist/tools/local-get-node-info-tool.d.ts.map +1 -0
- package/dist/tools/local-get-node-info-tool.js +75 -0
- package/dist/tools/local-get-node-info-tool.js.map +1 -0
- package/dist/tools/local-list-nodes-tool.d.ts +19 -0
- package/dist/tools/local-list-nodes-tool.d.ts.map +1 -0
- package/dist/tools/local-list-nodes-tool.js +69 -0
- package/dist/tools/local-list-nodes-tool.js.map +1 -0
- package/dist/tools/local-search-nodes-tool.d.ts +21 -0
- package/dist/tools/local-search-nodes-tool.d.ts.map +1 -0
- package/dist/tools/local-search-nodes-tool.js +111 -0
- package/dist/tools/local-search-nodes-tool.js.map +1 -0
- package/dist/tools/math-tools.d.ts +156 -0
- package/dist/tools/math-tools.d.ts.map +1 -0
- package/dist/tools/math-tools.js +422 -0
- package/dist/tools/math-tools.js.map +1 -0
- package/dist/tools/mcp-tools.d.ts +413 -0
- package/dist/tools/mcp-tools.d.ts.map +1 -0
- package/dist/tools/mcp-tools.js +618 -0
- package/dist/tools/mcp-tools.js.map +1 -0
- package/dist/tools/media-tools.d.ts +277 -0
- package/dist/tools/media-tools.d.ts.map +1 -0
- package/dist/tools/media-tools.js +682 -0
- package/dist/tools/media-tools.js.map +1 -0
- package/dist/tools/model-tools.d.ts +25 -0
- package/dist/tools/model-tools.d.ts.map +1 -0
- package/dist/tools/model-tools.js +48 -0
- package/dist/tools/model-tools.js.map +1 -0
- package/dist/tools/openai-tools.d.ts +73 -0
- package/dist/tools/openai-tools.d.ts.map +1 -0
- package/dist/tools/openai-tools.js +193 -0
- package/dist/tools/openai-tools.js.map +1 -0
- package/dist/tools/pdf-tools.d.ts +152 -0
- package/dist/tools/pdf-tools.d.ts.map +1 -0
- package/dist/tools/pdf-tools.js +339 -0
- package/dist/tools/pdf-tools.js.map +1 -0
- package/dist/tools/plan-builder-tools.d.ts +72 -0
- package/dist/tools/plan-builder-tools.d.ts.map +1 -0
- package/dist/tools/plan-builder-tools.js +438 -0
- package/dist/tools/plan-builder-tools.js.map +1 -0
- package/dist/tools/search-tools.d.ts +39 -0
- package/dist/tools/search-tools.d.ts.map +1 -0
- package/dist/tools/search-tools.js +218 -0
- package/dist/tools/search-tools.js.map +1 -0
- package/dist/tools/serp-providers/dataforseo-provider.d.ts +14 -0
- package/dist/tools/serp-providers/dataforseo-provider.d.ts.map +1 -0
- package/dist/tools/serp-providers/dataforseo-provider.js +114 -0
- package/dist/tools/serp-providers/dataforseo-provider.js.map +1 -0
- package/dist/tools/serp-providers/index.d.ts +35 -0
- package/dist/tools/serp-providers/index.d.ts.map +1 -0
- package/dist/tools/serp-providers/index.js +14 -0
- package/dist/tools/serp-providers/index.js.map +1 -0
- package/dist/tools/serp-providers/serpapi-provider.d.ts +18 -0
- package/dist/tools/serp-providers/serpapi-provider.d.ts.map +1 -0
- package/dist/tools/serp-providers/serpapi-provider.js +66 -0
- package/dist/tools/serp-providers/serpapi-provider.js.map +1 -0
- package/dist/tools/tool-registry.d.ts +9 -0
- package/dist/tools/tool-registry.d.ts.map +1 -0
- package/dist/tools/tool-registry.js +17 -0
- package/dist/tools/tool-registry.js.map +1 -0
- package/dist/tools/vector-tools.d.ts +224 -0
- package/dist/tools/vector-tools.d.ts.map +1 -0
- package/dist/tools/vector-tools.js +582 -0
- package/dist/tools/vector-tools.js.map +1 -0
- package/dist/tools/workspace-tools.d.ts +58 -0
- package/dist/tools/workspace-tools.d.ts.map +1 -0
- package/dist/tools/workspace-tools.js +152 -0
- package/dist/tools/workspace-tools.js.map +1 -0
- package/dist/types.d.ts +65 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/json-parser.d.ts +15 -0
- package/dist/utils/json-parser.d.ts.map +1 -0
- package/dist/utils/json-parser.js +78 -0
- package/dist/utils/json-parser.js.map +1 -0
- package/dist/utils/remove-base64-images.d.ts +12 -0
- package/dist/utils/remove-base64-images.d.ts.map +1 -0
- package/dist/utils/remove-base64-images.js +20 -0
- package/dist/utils/remove-base64-images.js.map +1 -0
- package/dist/utils/wrap-generators-parallel.d.ts +11 -0
- package/dist/utils/wrap-generators-parallel.d.ts.map +1 -0
- package/dist/utils/wrap-generators-parallel.js +38 -0
- package/dist/utils/wrap-generators-parallel.js.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace-scoped file tools — T-AG-1.
|
|
3
|
+
*
|
|
4
|
+
* Read, write, and list files relative to a workspace root directory.
|
|
5
|
+
* All paths are sandboxed to prevent traversal outside the workspace.
|
|
6
|
+
*/
|
|
7
|
+
import { readFile, writeFile, mkdir, readdir, stat, access } from "node:fs/promises";
|
|
8
|
+
import { resolve, join, dirname } from "node:path";
|
|
9
|
+
import { Tool } from "./base-tool.js";
|
|
10
|
+
function resolveSandboxed(workspaceRoot, userPath) {
|
|
11
|
+
const root = resolve(workspaceRoot);
|
|
12
|
+
const resolved = resolve(root, userPath);
|
|
13
|
+
if (!resolved.startsWith(root + "/") && resolved !== root) {
|
|
14
|
+
throw new Error("Path traversal not allowed");
|
|
15
|
+
}
|
|
16
|
+
return resolved;
|
|
17
|
+
}
|
|
18
|
+
export class WorkspaceReadTool extends Tool {
|
|
19
|
+
name = "workspace_read";
|
|
20
|
+
description = "Read a file relative to the agent workspace root.";
|
|
21
|
+
inputSchema = {
|
|
22
|
+
type: "object",
|
|
23
|
+
properties: {
|
|
24
|
+
path: {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "File path relative to workspace"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
required: ["path"]
|
|
30
|
+
};
|
|
31
|
+
workspaceRoot;
|
|
32
|
+
constructor(workspaceRoot) {
|
|
33
|
+
super();
|
|
34
|
+
this.workspaceRoot = workspaceRoot;
|
|
35
|
+
}
|
|
36
|
+
async process(_context, params) {
|
|
37
|
+
const rawPath = params.path;
|
|
38
|
+
if (typeof rawPath !== "string")
|
|
39
|
+
return { success: false, error: "path must be a string" };
|
|
40
|
+
let filePath;
|
|
41
|
+
try {
|
|
42
|
+
filePath = resolveSandboxed(this.workspaceRoot, rawPath);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return { success: false, error: "Path traversal not allowed" };
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
await access(filePath);
|
|
49
|
+
const content = await readFile(filePath, "utf-8");
|
|
50
|
+
return { success: true, path: rawPath, content };
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return { success: false, error: `File not found: ${rawPath}` };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export class WorkspaceWriteTool extends Tool {
|
|
58
|
+
name = "workspace_write";
|
|
59
|
+
description = "Write a file relative to the agent workspace root.";
|
|
60
|
+
inputSchema = {
|
|
61
|
+
type: "object",
|
|
62
|
+
properties: {
|
|
63
|
+
path: {
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "File path relative to workspace"
|
|
66
|
+
},
|
|
67
|
+
content: { type: "string", description: "Content to write" }
|
|
68
|
+
},
|
|
69
|
+
required: ["path", "content"]
|
|
70
|
+
};
|
|
71
|
+
workspaceRoot;
|
|
72
|
+
constructor(workspaceRoot) {
|
|
73
|
+
super();
|
|
74
|
+
this.workspaceRoot = workspaceRoot;
|
|
75
|
+
}
|
|
76
|
+
async process(_context, params) {
|
|
77
|
+
const rawPath = params.path;
|
|
78
|
+
const content = params.content;
|
|
79
|
+
if (typeof rawPath !== "string")
|
|
80
|
+
return { success: false, error: "path must be a string" };
|
|
81
|
+
if (typeof content !== "string")
|
|
82
|
+
return { success: false, error: "content must be a string" };
|
|
83
|
+
let filePath;
|
|
84
|
+
try {
|
|
85
|
+
filePath = resolveSandboxed(this.workspaceRoot, rawPath);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return { success: false, error: "Path traversal not allowed" };
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
await mkdir(dirname(filePath), { recursive: true });
|
|
92
|
+
await writeFile(filePath, content, "utf-8");
|
|
93
|
+
return { success: true, path: rawPath };
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
return {
|
|
97
|
+
success: false,
|
|
98
|
+
error: `Failed to write: ${e instanceof Error ? e.message : String(e)}`
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export class WorkspaceListTool extends Tool {
|
|
104
|
+
name = "workspace_list";
|
|
105
|
+
description = "List directory contents relative to the agent workspace root.";
|
|
106
|
+
inputSchema = {
|
|
107
|
+
type: "object",
|
|
108
|
+
properties: {
|
|
109
|
+
path: {
|
|
110
|
+
type: "string",
|
|
111
|
+
description: "Directory path relative to workspace"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
required: ["path"]
|
|
115
|
+
};
|
|
116
|
+
workspaceRoot;
|
|
117
|
+
constructor(workspaceRoot) {
|
|
118
|
+
super();
|
|
119
|
+
this.workspaceRoot = workspaceRoot;
|
|
120
|
+
}
|
|
121
|
+
async process(_context, params) {
|
|
122
|
+
const rawPath = params.path;
|
|
123
|
+
if (typeof rawPath !== "string")
|
|
124
|
+
return { success: false, error: "path must be a string" };
|
|
125
|
+
let dirPath;
|
|
126
|
+
try {
|
|
127
|
+
dirPath = resolveSandboxed(this.workspaceRoot, rawPath);
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
return { success: false, error: "Path traversal not allowed" };
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
const dirEntries = await readdir(dirPath, { withFileTypes: true });
|
|
134
|
+
const entries = await Promise.all(dirEntries.map(async (entry) => {
|
|
135
|
+
let size = 0;
|
|
136
|
+
try {
|
|
137
|
+
const info = await stat(join(dirPath, entry.name));
|
|
138
|
+
size = info.size;
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
/* ignore */
|
|
142
|
+
}
|
|
143
|
+
return { name: entry.name, size, is_dir: entry.isDirectory() };
|
|
144
|
+
}));
|
|
145
|
+
return { success: true, entries };
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
return { success: false, error: `Directory not found: ${rawPath}` };
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=workspace-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-tools.js","sourceRoot":"","sources":["../../src/tools/workspace-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,QAAQ,EACR,SAAS,EACT,KAAK,EACL,OAAO,EACP,IAAI,EACJ,MAAM,EACP,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAY,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EAAE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F"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core type definitions for the agent system.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Agent execution mode:
|
|
6
|
+
* - "loop": Simple iterative LLM + tool calling loop (like SimpleAgent)
|
|
7
|
+
* - "plan": LLM creates a task plan, then executes steps (like Agent)
|
|
8
|
+
* - "multi-agent": Multiple sub-agents running in parallel (like TeamExecutor)
|
|
9
|
+
*/
|
|
10
|
+
export type AgentMode = "loop" | "plan" | "multi-agent";
|
|
11
|
+
/**
|
|
12
|
+
* Configuration for a sub-agent in multi-agent mode.
|
|
13
|
+
* Used when auto-specializing agents from an objective.
|
|
14
|
+
*/
|
|
15
|
+
export interface SubAgentConfig {
|
|
16
|
+
/** Human-readable name for the sub-agent. */
|
|
17
|
+
name: string;
|
|
18
|
+
/** Role description for the sub-agent. */
|
|
19
|
+
role: string;
|
|
20
|
+
/** Skill tags for task matching. */
|
|
21
|
+
skills: string[];
|
|
22
|
+
/** Tool names this sub-agent can use (beyond team tools). */
|
|
23
|
+
tools?: string[];
|
|
24
|
+
/** Override model for this sub-agent. If not set, uses the parent agent's model. */
|
|
25
|
+
model?: string;
|
|
26
|
+
/** Override provider for this sub-agent. If not set, uses the parent agent's provider. */
|
|
27
|
+
provider?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface Step {
|
|
30
|
+
id: string;
|
|
31
|
+
instructions: string;
|
|
32
|
+
completed: boolean;
|
|
33
|
+
startTime?: number;
|
|
34
|
+
endTime?: number;
|
|
35
|
+
dependsOn: string[];
|
|
36
|
+
tools?: string[];
|
|
37
|
+
outputSchema?: string;
|
|
38
|
+
logs: string[];
|
|
39
|
+
/** Step execution mode: discover produces a list, process fans out over it, aggregate collects. */
|
|
40
|
+
mode?: "discover" | "process" | "aggregate";
|
|
41
|
+
/** Template with {field} placeholders, rendered per item for process-mode fan-out. */
|
|
42
|
+
perItemInstructions?: string;
|
|
43
|
+
/** JSON schema string applied to each ephemeral step's output in process mode. */
|
|
44
|
+
perItemSchema?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface Task {
|
|
47
|
+
id: string;
|
|
48
|
+
title: string;
|
|
49
|
+
description?: string;
|
|
50
|
+
steps: Step[];
|
|
51
|
+
/** Task IDs this task depends on. Used in multi-task plans for inter-task ordering. */
|
|
52
|
+
dependsOn?: string[];
|
|
53
|
+
/** Whether this task has been completed. Set by ParallelTaskExecutor. */
|
|
54
|
+
completed?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A plan with multiple tasks that can be executed in parallel.
|
|
58
|
+
* Tasks form a DAG via their `dependsOn` arrays. Independent tasks
|
|
59
|
+
* run concurrently as sub-agents, each with their own StepExecutor chain.
|
|
60
|
+
*/
|
|
61
|
+
export interface TaskPlan {
|
|
62
|
+
title: string;
|
|
63
|
+
tasks: Task[];
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,aAAa,CAAC;AAExD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,oFAAoF;IACpF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,mGAAmG;IACnG,IAAI,CAAC,EAAE,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;IAC5C,sFAAsF;IACtF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kFAAkF;IAClF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,yEAAyE;IACzE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;CACf"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility for extracting JSON from LLM text output.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Attempt to extract a JSON value from a text string.
|
|
6
|
+
*
|
|
7
|
+
* Strategies (in order):
|
|
8
|
+
* 1. Direct JSON.parse of the trimmed text.
|
|
9
|
+
* 2. Extract from a fenced ```json code block.
|
|
10
|
+
* 3. Find the first balanced { ... } substring.
|
|
11
|
+
*
|
|
12
|
+
* Returns null if no valid JSON can be extracted.
|
|
13
|
+
*/
|
|
14
|
+
export declare function extractJSON(text: string): unknown | null;
|
|
15
|
+
//# sourceMappingURL=json-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-parser.d.ts","sourceRoot":"","sources":["../../src/utils/json-parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CA6DxD"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility for extracting JSON from LLM text output.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Attempt to extract a JSON value from a text string.
|
|
6
|
+
*
|
|
7
|
+
* Strategies (in order):
|
|
8
|
+
* 1. Direct JSON.parse of the trimmed text.
|
|
9
|
+
* 2. Extract from a fenced ```json code block.
|
|
10
|
+
* 3. Find the first balanced { ... } substring.
|
|
11
|
+
*
|
|
12
|
+
* Returns null if no valid JSON can be extracted.
|
|
13
|
+
*/
|
|
14
|
+
export function extractJSON(text) {
|
|
15
|
+
const trimmed = text.trim();
|
|
16
|
+
// Strategy 1: direct parse
|
|
17
|
+
try {
|
|
18
|
+
return JSON.parse(trimmed);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
// continue
|
|
22
|
+
}
|
|
23
|
+
// Strategy 2: fenced code block
|
|
24
|
+
const fenceMatch = trimmed.match(/```(?:json)?\s*\n?([\s\S]*?)\n?```/);
|
|
25
|
+
if (fenceMatch?.[1]) {
|
|
26
|
+
try {
|
|
27
|
+
return JSON.parse(fenceMatch[1].trim());
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// continue
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Strategy 3: balanced braces or brackets
|
|
34
|
+
for (const [open, close] of [
|
|
35
|
+
["{", "}"],
|
|
36
|
+
["[", "]"]
|
|
37
|
+
]) {
|
|
38
|
+
const startIdx = trimmed.indexOf(open);
|
|
39
|
+
if (startIdx === -1)
|
|
40
|
+
continue;
|
|
41
|
+
let depth = 0;
|
|
42
|
+
let inString = false;
|
|
43
|
+
let escape = false;
|
|
44
|
+
for (let i = startIdx; i < trimmed.length; i++) {
|
|
45
|
+
const ch = trimmed[i];
|
|
46
|
+
if (escape) {
|
|
47
|
+
escape = false;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (ch === "\\") {
|
|
51
|
+
escape = true;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (ch === '"') {
|
|
55
|
+
inString = !inString;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (inString)
|
|
59
|
+
continue;
|
|
60
|
+
if (ch === open)
|
|
61
|
+
depth++;
|
|
62
|
+
if (ch === close) {
|
|
63
|
+
depth--;
|
|
64
|
+
if (depth === 0) {
|
|
65
|
+
const candidate = trimmed.slice(startIdx, i + 1);
|
|
66
|
+
try {
|
|
67
|
+
return JSON.parse(candidate);
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// continue searching
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=json-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-parser.js","sourceRoot":"","sources":["../../src/utils/json-parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAE5B,2BAA2B;IAC3B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAAC,MA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AK,EAAE,CAAC;YACzB,IAAI,EAAE,KAAK,KAAK,EAAE,CAAC;gBACjB,KAAK,EAAE,CAAC;gBACR,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;oBAChB,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;oBACjD,IAAI,CAAC;wBACH,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;oBAC/B,CAAC;oBAAC,MAAM,CAAC;wBACP,qBAAqB;oBACvB,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* removeBase64Images — T-AG-7.
|
|
3
|
+
*
|
|
4
|
+
* Strips image content blocks where the data is base64-encoded.
|
|
5
|
+
*/
|
|
6
|
+
import type { MessageContent } from "@nodetool-ai/runtime";
|
|
7
|
+
/**
|
|
8
|
+
* Remove base64 image content blocks from a message content array.
|
|
9
|
+
* Preserves text content, audio content, and images with real URLs.
|
|
10
|
+
*/
|
|
11
|
+
export declare function removeBase64Images(content: MessageContent[]): MessageContent[];
|
|
12
|
+
//# sourceMappingURL=remove-base64-images.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-base64-images.d.ts","sourceRoot":"","sources":["../../src/utils/remove-base64-images.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,cAAc,EAAuB,MAAM,sBAAsB,CAAC;AAShF;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,cAAc,EAAE,GACxB,cAAc,EAAE,CAKlB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function isBase64Image(content) {
|
|
2
|
+
const { uri, data } = content.image;
|
|
3
|
+
if (uri && uri.startsWith("data:image/"))
|
|
4
|
+
return true;
|
|
5
|
+
if (data != null)
|
|
6
|
+
return true;
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Remove base64 image content blocks from a message content array.
|
|
11
|
+
* Preserves text content, audio content, and images with real URLs.
|
|
12
|
+
*/
|
|
13
|
+
export function removeBase64Images(content) {
|
|
14
|
+
return content.filter((item) => {
|
|
15
|
+
if (item.type !== "image_url")
|
|
16
|
+
return true;
|
|
17
|
+
return !isBase64Image(item);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=remove-base64-images.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-base64-images.js","sourceRoot":"","sources":["../../src/utils/remove-base64-images.ts"],"names":[],"mappings":"AAOA,SAAS,aAAa,CAAC,OAA4B;IACjD,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC;IACpC,IAAI,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC;QAAE,OAAO,IAAI,CAAC;IACtD,IAAI,IAAI,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IAC9B,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAyB;IAEzB,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QAC7B,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW;YAAE,OAAO,IAAI,CAAC;QAC3C,OAAO,CAAC,aAAa,CAAC,IAA2B,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* wrapGeneratorsParallel — T-AG-8.
|
|
3
|
+
*
|
|
4
|
+
* Merges multiple async generators into one, yielding items in arrival order.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Yield items from all generators concurrently in arrival order.
|
|
8
|
+
* Uses Promise.race to return whichever generator produces a value first.
|
|
9
|
+
*/
|
|
10
|
+
export declare function wrapGeneratorsParallel<T>(generators: AsyncGenerator<T>[]): AsyncGenerator<T>;
|
|
11
|
+
//# sourceMappingURL=wrap-generators-parallel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap-generators-parallel.d.ts","sourceRoot":"","sources":["../../src/utils/wrap-generators-parallel.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,wBAAuB,sBAAsB,CAAC,CAAC,EAC7C,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,GAC9B,cAAc,CAAC,CAAC,CAAC,CAqCnB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* wrapGeneratorsParallel — T-AG-8.
|
|
3
|
+
*
|
|
4
|
+
* Merges multiple async generators into one, yielding items in arrival order.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Yield items from all generators concurrently in arrival order.
|
|
8
|
+
* Uses Promise.race to return whichever generator produces a value first.
|
|
9
|
+
*/
|
|
10
|
+
export async function* wrapGeneratorsParallel(generators) {
|
|
11
|
+
if (generators.length === 0)
|
|
12
|
+
return;
|
|
13
|
+
const slots = generators.map((gen, index) => {
|
|
14
|
+
const slot = {
|
|
15
|
+
gen,
|
|
16
|
+
index,
|
|
17
|
+
done: false,
|
|
18
|
+
promise: gen.next().then((result) => ({ index, result }))
|
|
19
|
+
};
|
|
20
|
+
return slot;
|
|
21
|
+
});
|
|
22
|
+
while (true) {
|
|
23
|
+
const activeSlots = slots.filter((s) => !s.done);
|
|
24
|
+
if (activeSlots.length === 0)
|
|
25
|
+
break;
|
|
26
|
+
const { index, result } = await Promise.race(activeSlots.map((s) => s.promise));
|
|
27
|
+
const slot = slots[index];
|
|
28
|
+
if (result.done) {
|
|
29
|
+
slot.done = true;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
yield result.value;
|
|
33
|
+
// Advance this generator
|
|
34
|
+
slot.promise = slot.gen.next().then((r) => ({ index, result: r }));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=wrap-generators-parallel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap-generators-parallel.js","sourceRoot":"","sources":["../../src/utils/wrap-generators-parallel.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,sBAAsB,CAC3C,UAA+B;IAE/B,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IASpC,MAAM,KAAK,GAAW,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QAClD,MAAM,IAAI,GAAS;YACjB,GAAG;YACH,KAAK;YACL,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;SAC1D,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACjD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM;QAEpC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,IAAI,CAC1C,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAClC,CAAC;QAEF,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YAChB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,CAAC,KAAK,CAAC;YACnB,yBAAyB;YACzB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nodetool-ai/agents",
|
|
3
|
+
"version": "0.7.0-rc.11",
|
|
4
|
+
"description": "Agent system for planning and executing multi-step LLM tasks",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "node ../../scripts/build-typescript-workspace.mjs",
|
|
10
|
+
"test": "vitest run",
|
|
11
|
+
"test:watch": "vitest",
|
|
12
|
+
"lint": "tsc --noEmit"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@jitl/quickjs-ng-wasmfile-release-sync": "^0.31.0",
|
|
16
|
+
"@llamaindex/liteparse": "^1.5.2",
|
|
17
|
+
"@nodetool-ai/config": "^0.7.0-rc.11",
|
|
18
|
+
"@nodetool-ai/kernel": "^0.7.0-rc.11",
|
|
19
|
+
"@nodetool-ai/models": "^0.7.0-rc.11",
|
|
20
|
+
"@nodetool-ai/node-sdk": "^0.7.0-rc.11",
|
|
21
|
+
"@nodetool-ai/protocol": "^0.7.0-rc.11",
|
|
22
|
+
"@nodetool-ai/runtime": "^0.7.0-rc.11",
|
|
23
|
+
"@sebastianwessel/quickjs": "^3.0.1",
|
|
24
|
+
"@types/mailparser": "^3.4.6",
|
|
25
|
+
"imapflow": "^1.2.12",
|
|
26
|
+
"js-tiktoken": "^1.0.18",
|
|
27
|
+
"mailparser": "^3.9.3"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^22.0.0",
|
|
31
|
+
"typescript": "^5.7.2",
|
|
32
|
+
"vitest": "^4.1.2"
|
|
33
|
+
},
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"nodetool-dev": "./src/index.ts",
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"import": "./dist/index.js",
|
|
39
|
+
"default": "./dist/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./tool": {
|
|
42
|
+
"nodetool-dev": "./src/tools/base-tool.ts",
|
|
43
|
+
"types": "./dist/tools/base-tool.d.ts",
|
|
44
|
+
"import": "./dist/tools/base-tool.js",
|
|
45
|
+
"default": "./dist/tools/base-tool.js"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"license": "MIT",
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "https://github.com/nodetool-ai/nodetool.git",
|
|
52
|
+
"directory": "packages/agents"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://nodetool.ai",
|
|
55
|
+
"bugs": {
|
|
56
|
+
"url": "https://github.com/nodetool-ai/nodetool/issues"
|
|
57
|
+
},
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"access": "public"
|
|
60
|
+
},
|
|
61
|
+
"files": [
|
|
62
|
+
"dist",
|
|
63
|
+
"README.md"
|
|
64
|
+
]
|
|
65
|
+
}
|