@adminforth/agent 3.1.10 → 3.2.0
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/README.md +71 -38
- package/dist/application/ports.d.ts +3 -1
- package/dist/application/runTurnUseCase.d.ts +3 -3
- package/dist/application/runTurnUseCase.js +8 -6
- package/dist/custom/{skills/charts/SKILL.md → charts.md} +2 -4
- package/dist/domain/systemPrompt.d.ts +3 -2
- package/dist/domain/systemPrompt.js +14 -53
- package/dist/index.d.ts +0 -3
- package/dist/index.js +24 -35
- package/dist/llm/agentRuntime.d.ts +9 -8
- package/dist/llm/agentRuntime.js +134 -106
- package/dist/llm/langGraphLlm.d.ts +3 -0
- package/dist/llm/langGraphLlm.js +10 -2
- package/dist/llm/middleware/mcpToolsMiddleware.d.ts +7 -0
- package/dist/llm/middleware/{apiToolsMiddleware.js → mcpToolsMiddleware.js} +16 -36
- package/dist/tools/agentToolProvider.d.ts +16 -5
- package/dist/tools/agentToolProvider.js +26 -10
- package/dist/tools/fetchToolSchema.d.ts +7 -3
- package/dist/tools/fetchToolSchema.js +29 -22
- package/dist/tools/mcpConnection.d.ts +38 -0
- package/dist/tools/mcpConnection.js +42 -0
- package/dist/tools/mcpTool.d.ts +3 -0
- package/dist/tools/{apiTool.js → mcpTool.js} +7 -23
- package/dist/tools/toolLabels.d.ts +5 -0
- package/dist/tools/toolLabels.js +49 -0
- package/dist/transport/http/context.d.ts +2 -2
- package/dist/transport/http/sessionEndpoints.js +1 -1
- package/package.json +6 -4
- package/dist/custom/skills/analyze_data/SKILL.md +0 -25
- package/dist/custom/skills/fetch_data/SKILL.md +0 -31
- package/dist/custom/skills/mutate_data/SKILL.md +0 -121
- package/dist/llm/middleware/apiToolsMiddleware.d.ts +0 -3
- package/dist/tools/apiBasedTools.d.ts +0 -30
- package/dist/tools/apiBasedTools.js +0 -488
- package/dist/tools/apiTool.d.ts +0 -6
- package/dist/tools/fetchSkill.d.ts +0 -8
- package/dist/tools/fetchSkill.js +0 -51
- package/dist/tools/index.d.ts +0 -4
- package/dist/tools/index.js +0 -32
- package/dist/tools/skills/registry.d.ts +0 -11
- package/dist/tools/skills/registry.js +0 -107
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { readdir, readFile } from "fs/promises";
|
|
11
|
-
import path from "path";
|
|
12
|
-
import { parse as parseYaml } from "yaml";
|
|
13
|
-
const SKILL_MARKDOWN_FILENAME = "SKILL.md";
|
|
14
|
-
const SKILL_FRONTMATTER_SEPARATOR = "\n---\n";
|
|
15
|
-
function normalizePluginSkillDirectoryPaths(pluginCustomFolderPaths = []) {
|
|
16
|
-
return Array.from(new Set(pluginCustomFolderPaths
|
|
17
|
-
.map((pluginCustomFolderPath) => path.resolve(pluginCustomFolderPath, "skills"))));
|
|
18
|
-
}
|
|
19
|
-
function parseSkillManifest(directoryName, markdown) {
|
|
20
|
-
var _a, _b;
|
|
21
|
-
const [frontmatterBlock, instructions = ""] = markdown.split("\r\n").join("\n").split(SKILL_FRONTMATTER_SEPARATOR, 2);
|
|
22
|
-
const metadata = parseYaml(frontmatterBlock);
|
|
23
|
-
return {
|
|
24
|
-
directoryName,
|
|
25
|
-
name: (_a = metadata.name) !== null && _a !== void 0 ? _a : directoryName,
|
|
26
|
-
description: (_b = metadata.description) !== null && _b !== void 0 ? _b : "",
|
|
27
|
-
instructions: instructions.trim(),
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function readSkillManifest(skillsDirectoryPath, directoryName) {
|
|
31
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
const markdown = yield readFile(path.join(skillsDirectoryPath, directoryName, SKILL_MARKDOWN_FILENAME), "utf8");
|
|
33
|
-
return parseSkillManifest(directoryName, markdown);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function listDirectorySkillManifests(skillsDirectoryPath) {
|
|
37
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
try {
|
|
39
|
-
const entries = yield readdir(skillsDirectoryPath, { withFileTypes: true });
|
|
40
|
-
return yield Promise.all(entries
|
|
41
|
-
.filter((entry) => entry.isDirectory())
|
|
42
|
-
.map((entry) => entry.name)
|
|
43
|
-
.sort()
|
|
44
|
-
.map((directoryName) => readSkillManifest(skillsDirectoryPath, directoryName)));
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
if (error.code === "ENOENT") {
|
|
48
|
-
return [];
|
|
49
|
-
}
|
|
50
|
-
throw error;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
function mergeSkillManifests(skillGroups) {
|
|
55
|
-
return Array.from(new Map(skillGroups.flat().map((skill) => [
|
|
56
|
-
`${skill.name}:${skill.directoryName}`,
|
|
57
|
-
skill,
|
|
58
|
-
])).values());
|
|
59
|
-
}
|
|
60
|
-
export function getProjectSkillsDirectoryPath(customComponentsDir) {
|
|
61
|
-
return path.resolve(customComponentsDir, "skills");
|
|
62
|
-
}
|
|
63
|
-
function getProjectSkillDirectoryPaths(customComponentsDir, pluginCustomFolderPaths = []) {
|
|
64
|
-
return Array.from(new Set([
|
|
65
|
-
getProjectSkillsDirectoryPath(customComponentsDir),
|
|
66
|
-
...normalizePluginSkillDirectoryPaths(pluginCustomFolderPaths),
|
|
67
|
-
]));
|
|
68
|
-
}
|
|
69
|
-
export function listProjectSkillManifests(customComponentsDir_1) {
|
|
70
|
-
return __awaiter(this, arguments, void 0, function* (customComponentsDir, pluginCustomFolderPaths = []) {
|
|
71
|
-
return mergeSkillManifests(yield Promise.all(getProjectSkillDirectoryPaths(customComponentsDir, pluginCustomFolderPaths).map(listDirectorySkillManifests)));
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
export function listSkillManifests(customComponentsDir_1) {
|
|
75
|
-
return __awaiter(this, arguments, void 0, function* (customComponentsDir, pluginCustomFolderPaths = []) {
|
|
76
|
-
return yield listProjectSkillManifests(customComponentsDir, pluginCustomFolderPaths);
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
export function loadSkillManifest(skillName_1, customComponentsDir_1) {
|
|
80
|
-
return __awaiter(this, arguments, void 0, function* (skillName, customComponentsDir, pluginCustomFolderPaths = []) {
|
|
81
|
-
var _a;
|
|
82
|
-
const manifests = yield listSkillManifests(customComponentsDir, pluginCustomFolderPaths);
|
|
83
|
-
return ((_a = manifests.find((manifest) => manifest.name === skillName || manifest.directoryName === skillName)) !== null && _a !== void 0 ? _a : null);
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
export function loadSkillMarkdown(skillName_1, customComponentsDir_1) {
|
|
87
|
-
return __awaiter(this, arguments, void 0, function* (skillName, customComponentsDir, pluginCustomFolderPaths = []) {
|
|
88
|
-
const manifest = yield loadSkillManifest(skillName, customComponentsDir, pluginCustomFolderPaths);
|
|
89
|
-
if (!manifest) {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
const directories = [
|
|
93
|
-
...getProjectSkillDirectoryPaths(customComponentsDir, pluginCustomFolderPaths),
|
|
94
|
-
];
|
|
95
|
-
for (const skillsDirectoryPath of directories) {
|
|
96
|
-
try {
|
|
97
|
-
return yield readFile(path.join(skillsDirectoryPath, manifest.directoryName, SKILL_MARKDOWN_FILENAME), "utf8");
|
|
98
|
-
}
|
|
99
|
-
catch (error) {
|
|
100
|
-
if (error.code !== "ENOENT") {
|
|
101
|
-
throw error;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return null;
|
|
106
|
-
});
|
|
107
|
-
}
|