@becrafter/prompt-manager 0.1.22 → 0.1.31
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/package.json +23 -23
- package/packages/resources/tools/agent-browser/README.md +640 -0
- package/packages/resources/tools/agent-browser/agent-browser.tool.js +1388 -0
- package/packages/resources/tools/thinking/README.md +324 -0
- package/packages/resources/tools/thinking/thinking.tool.js +911 -0
- package/packages/server/README.md +3 -4
- package/packages/server/api/admin.routes.js +668 -664
- package/packages/server/api/open.routes.js +68 -67
- package/packages/server/api/surge.routes.js +5 -6
- package/packages/server/api/tool.routes.js +70 -71
- package/packages/server/app.js +70 -73
- package/packages/server/configs/authors.json +40 -0
- package/packages/server/configs/models/built-in/bigmodel.yaml +6 -6
- package/packages/server/configs/models/providers.yaml +4 -4
- package/packages/server/configs/templates/built-in/general-iteration.yaml +1 -1
- package/packages/server/configs/templates/built-in/general-optimize.yaml +1 -1
- package/packages/server/configs/templates/built-in/output-format-optimize.yaml +1 -1
- package/packages/server/index.js +3 -9
- package/packages/server/mcp/heartbeat-patch.js +1 -3
- package/packages/server/mcp/mcp.server.js +64 -134
- package/packages/server/mcp/prompt.handler.js +101 -95
- package/packages/server/middlewares/auth.middleware.js +31 -31
- package/packages/server/server.js +60 -45
- package/packages/server/services/TerminalService.js +156 -70
- package/packages/server/services/WebSocketService.js +35 -34
- package/packages/server/services/author-config.service.js +199 -0
- package/packages/server/services/manager.js +66 -60
- package/packages/server/services/model.service.js +5 -9
- package/packages/server/services/optimization.service.js +25 -22
- package/packages/server/services/template.service.js +3 -8
- package/packages/server/toolm/author-sync.service.js +97 -0
- package/packages/server/toolm/index.js +1 -2
- package/packages/server/toolm/package-installer.service.js +47 -50
- package/packages/server/toolm/tool-context.service.js +64 -62
- package/packages/server/toolm/tool-dependency.service.js +28 -30
- package/packages/server/toolm/tool-description-generator-optimized.service.js +55 -55
- package/packages/server/toolm/tool-description-generator.service.js +20 -23
- package/packages/server/toolm/tool-environment.service.js +45 -44
- package/packages/server/toolm/tool-execution.service.js +49 -48
- package/packages/server/toolm/tool-loader.service.js +13 -18
- package/packages/server/toolm/tool-logger.service.js +33 -39
- package/packages/server/toolm/tool-manager.handler.js +17 -15
- package/packages/server/toolm/tool-manual-generator.service.js +107 -87
- package/packages/server/toolm/tool-mode-handlers.service.js +52 -59
- package/packages/server/toolm/tool-storage.service.js +11 -12
- package/packages/server/toolm/tool-sync.service.js +36 -39
- package/packages/server/toolm/tool-utils.js +0 -1
- package/packages/server/toolm/tool-yaml-parser.service.js +12 -11
- package/packages/server/toolm/validate-system.js +56 -84
- package/packages/server/utils/config.js +97 -12
- package/packages/server/utils/logger.js +1 -1
- package/packages/server/utils/port-checker.js +8 -8
- package/packages/server/utils/util.js +470 -467
- package/packages/resources/tools/cognitive-thinking/README.md +0 -284
- package/packages/resources/tools/cognitive-thinking/cognitive-thinking.tool.js +0 -837
- package/packages/server/mcp/sequential-thinking.handler.js +0 -318
- package/packages/server/mcp/think-plan.handler.js +0 -274
- package/packages/server/mcp/thinking-toolkit.handler.js +0 -380
- package/packages/web/0.d1c5a72339dfc32ad86a.js +0 -1
- package/packages/web/112.8807b976372b2b0541a8.js +0 -1
- package/packages/web/130.584c7e365da413f5d9be.js +0 -1
- package/packages/web/142.72c985bc29720f975cca.js +0 -1
- package/packages/web/165.a05fc53bf84d18db36b8.js +0 -2
- package/packages/web/165.a05fc53bf84d18db36b8.js.LICENSE.txt +0 -9
- package/packages/web/203.724ab9f717b80554c397.js +0 -1
- package/packages/web/241.bf941d4f02866795f64a.js +0 -1
- package/packages/web/249.54cfb224af63f5f5ec55.js +0 -1
- package/packages/web/291.6df35042f8f296fca7cd.js +0 -1
- package/packages/web/319.2fab900a31b29873f666.js +0 -1
- package/packages/web/32.c78d866281995ec33a7b.js +0 -1
- package/packages/web/325.9ca297d0f73f38468ce9.js +0 -1
- package/packages/web/366.2f9b48fdbf8eee039e57.js +0 -1
- package/packages/web/378.6be08c612cd5a3ef97dc.js +0 -1
- package/packages/web/393.7a2f817515c5e90623d7.js +0 -1
- package/packages/web/412.062df5f732d5ba203415.js +0 -1
- package/packages/web/426.08656fef4918b3fb19ad.js +0 -1
- package/packages/web/465.2be8018327130a3bd798.js +0 -1
- package/packages/web/48.8ca96fc93667a715e67a.js +0 -1
- package/packages/web/480.44c1f1a2927486ac3d4f.js +0 -1
- package/packages/web/489.e041a8d0db15dc96d607.js +0 -1
- package/packages/web/490.9ffb26c907de020d671b.js +0 -1
- package/packages/web/492.58781369e348d91fc06a.js +0 -1
- package/packages/web/495.ed63e99791a87167c6b3.js +0 -1
- package/packages/web/510.4cc07ab7d30d5c1cd17f.js +0 -1
- package/packages/web/543.3af155ed4fa237664308.js +0 -1
- package/packages/web/567.f04ab60f8e2c2fb0745a.js +0 -1
- package/packages/web/592.f3ad085fa9c1849daa06.js +0 -1
- package/packages/web/616.b03fb801b3433b17750f.js +0 -1
- package/packages/web/617.d88def54921d2c4dc44c.js +0 -1
- package/packages/web/641.d30787d674f548928261.js +0 -1
- package/packages/web/672.5269c8399fa42a5af95d.js +0 -1
- package/packages/web/731.97cab92b71811c502bda.js +0 -1
- package/packages/web/746.3947c6f0235407e420fb.js +0 -1
- package/packages/web/756.a53233b3f3913900d5ac.js +0 -1
- package/packages/web/77.68801af593a28a631fbf.js +0 -1
- package/packages/web/802.53b2bff3cf2a69f7b80c.js +0 -1
- package/packages/web/815.b6dfab82265f56c7e046.js +0 -1
- package/packages/web/821.f5a13e5c735aac244eb9.js +0 -1
- package/packages/web/846.b9bf97d5f559270675ce.js +0 -1
- package/packages/web/869.7c10403f500e6201407f.js +0 -1
- package/packages/web/885.135050364f99e6924fb5.js +0 -1
- package/packages/web/901.fd5aeb9df630609a2b43.js +0 -1
- package/packages/web/928.f67e590de3caa4daa3ae.js +0 -1
- package/packages/web/955.d833403521ba4dd567ee.js +0 -1
- package/packages/web/981.a45cb745cf424044c8c8.js +0 -1
- package/packages/web/992.645320b60c74c8787482.js +0 -1
- package/packages/web/996.ed9a963dc9e7439eca9a.js +0 -1
- package/packages/web/css/codemirror-theme_xq-light.css +0 -43
- package/packages/web/css/codemirror.css +0 -344
- package/packages/web/css/main.196f434e6a88cd448158.css +0 -7278
- package/packages/web/css/terminal-fix.css +0 -571
- package/packages/web/index.html +0 -3
- package/packages/web/main.dceff50c7307dda04873.js +0 -2
- package/packages/web/main.dceff50c7307dda04873.js.LICENSE.txt +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 工具存储服务
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* 职责:
|
|
5
5
|
* 1. 为每个工具提供独立的存储空间
|
|
6
6
|
* 2. 数据持久化到工具目录的 data 目录
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
import fs from 'fs-extra';
|
|
11
11
|
import path from 'path';
|
|
12
|
-
import os from 'os';
|
|
13
12
|
import { logger } from '../utils/logger.js';
|
|
14
13
|
import { pathExists } from './tool-utils.js';
|
|
14
|
+
import { config } from '../utils/config.js';
|
|
15
15
|
|
|
16
16
|
// 存储缓存:toolName -> storage data
|
|
17
17
|
const storageCache = new Map();
|
|
@@ -25,18 +25,18 @@ export function getStorage(toolName) {
|
|
|
25
25
|
if (!storageCache.has(toolName)) {
|
|
26
26
|
storageCache.set(toolName, {});
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
const storage = storageCache.get(toolName);
|
|
30
30
|
const storageFile = getStorageFilePath(toolName);
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
// 加载存储数据(如果存在)
|
|
33
33
|
loadStorageData(toolName, storageFile, storage);
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
return {
|
|
36
|
-
getItem:
|
|
36
|
+
getItem: key => {
|
|
37
37
|
return storage[key];
|
|
38
38
|
},
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
setItem: (key, value) => {
|
|
41
41
|
storage[key] = value;
|
|
42
42
|
// 异步保存
|
|
@@ -44,15 +44,15 @@ export function getStorage(toolName) {
|
|
|
44
44
|
logger.error(`保存工具存储失败: ${toolName}`, { error: error.message });
|
|
45
45
|
});
|
|
46
46
|
},
|
|
47
|
-
|
|
48
|
-
removeItem:
|
|
47
|
+
|
|
48
|
+
removeItem: key => {
|
|
49
49
|
delete storage[key];
|
|
50
50
|
// 异步保存
|
|
51
51
|
saveStorageData(toolName, storageFile, storage).catch(error => {
|
|
52
52
|
logger.error(`保存工具存储失败: ${toolName}`, { error: error.message });
|
|
53
53
|
});
|
|
54
54
|
},
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
clear: () => {
|
|
57
57
|
storageCache.set(toolName, {});
|
|
58
58
|
// 删除存储文件
|
|
@@ -69,7 +69,7 @@ export function getStorage(toolName) {
|
|
|
69
69
|
* @returns {string} 存储文件路径
|
|
70
70
|
*/
|
|
71
71
|
function getStorageFilePath(toolName) {
|
|
72
|
-
const toolDir =
|
|
72
|
+
const toolDir = config.getToolDir(toolName);
|
|
73
73
|
return path.join(toolDir, 'data', 'storage.json');
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -108,4 +108,3 @@ async function saveStorageData(toolName, storageFile, storage) {
|
|
|
108
108
|
throw error;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 工具同步服务
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* 职责:
|
|
5
5
|
* 1. 将系统内置工具从 packages/resources/tools/ 同步到 ~/.prompt-manager/toolbox/
|
|
6
6
|
* 2. 为每个工具创建独立的沙箱目录结构
|
|
7
7
|
* 3. 生成 package.json 文件(如果不存在)
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
9
|
* 执行时机:
|
|
10
10
|
* - HTTP 服务启动时(server.js 的 startServer() 函数中)
|
|
11
11
|
* - 在 MCP 服务器初始化之前执行
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
|
|
14
14
|
import fs from 'fs-extra';
|
|
15
15
|
import path from 'path';
|
|
16
|
-
import os from 'os';
|
|
17
16
|
import { fileURLToPath } from 'url';
|
|
18
17
|
import { logger } from '../utils/logger.js';
|
|
19
18
|
import { pathExists } from './tool-utils.js';
|
|
19
|
+
import { config } from '../utils/config.js';
|
|
20
20
|
|
|
21
21
|
const __filename = fileURLToPath(import.meta.url);
|
|
22
22
|
const __dirname = path.dirname(__filename);
|
|
@@ -26,11 +26,11 @@ const __dirname = path.dirname(__filename);
|
|
|
26
26
|
*/
|
|
27
27
|
export async function syncSystemTools() {
|
|
28
28
|
logger.info('开始同步系统工具到沙箱环境...');
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
// 判断运行环境类型
|
|
31
|
-
const isElectronPackaged =
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const isElectronPackaged =
|
|
32
|
+
process.resourcesPath &&
|
|
33
|
+
(process.resourcesPath.includes('app.asar') || process.resourcesPath.includes('Electron.app'));
|
|
34
34
|
|
|
35
35
|
const isNpmPackage = __dirname.includes('node_modules');
|
|
36
36
|
|
|
@@ -49,26 +49,26 @@ export async function syncSystemTools() {
|
|
|
49
49
|
toolsDir = path.join(__dirname, '..', '..', 'resources', 'tools');
|
|
50
50
|
logger.debug('开发环境,使用工具目录:', { toolsDir });
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
// 目标沙箱目录
|
|
54
|
-
const toolboxDir =
|
|
55
|
-
|
|
54
|
+
const toolboxDir = config.getToolboxDir();
|
|
55
|
+
|
|
56
56
|
// 确保工具箱目录存在
|
|
57
57
|
await fs.ensureDir(toolboxDir);
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
// 检查源目录是否存在
|
|
60
|
-
if (!await pathExists(toolsDir)) {
|
|
60
|
+
if (!(await pathExists(toolsDir))) {
|
|
61
61
|
logger.warn(`系统工具目录不存在,跳过同步: ${toolsDir}`);
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
// 在打包环境中,如果工具目录不存在,尝试从其他可能的位置查找
|
|
64
|
-
if (
|
|
64
|
+
if (isElectronPackaged) {
|
|
65
65
|
// 尝试其他可能的路径
|
|
66
66
|
const alternativePaths = [
|
|
67
67
|
path.join(process.resourcesPath, 'app.asar', 'runtime', 'toolbox'),
|
|
68
68
|
path.join(process.resourcesPath, '..', 'runtime', 'toolbox'),
|
|
69
69
|
path.join(__dirname, '..', '..', 'resources', 'tools') // 回退到开发路径
|
|
70
70
|
];
|
|
71
|
-
|
|
71
|
+
|
|
72
72
|
for (const altPath of alternativePaths) {
|
|
73
73
|
if (await pathExists(altPath)) {
|
|
74
74
|
toolsDir = altPath;
|
|
@@ -76,8 +76,8 @@ export async function syncSystemTools() {
|
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
if (!await pathExists(toolsDir)) {
|
|
79
|
+
|
|
80
|
+
if (!(await pathExists(toolsDir))) {
|
|
81
81
|
logger.warn('所有可能的工具目录都不存在,跳过工具同步');
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
@@ -85,37 +85,37 @@ export async function syncSystemTools() {
|
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
|
|
89
89
|
try {
|
|
90
90
|
// 读取系统工具目录
|
|
91
91
|
const entries = await fs.readdir(toolsDir, { withFileTypes: true });
|
|
92
|
-
|
|
92
|
+
|
|
93
93
|
let syncedCount = 0;
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
for (const entry of entries) {
|
|
96
96
|
if (!entry.isDirectory()) {
|
|
97
97
|
continue;
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
|
|
100
100
|
const toolName = entry.name;
|
|
101
101
|
const toolDir = path.join(toolsDir, toolName);
|
|
102
102
|
const toolFile = path.join(toolDir, `${toolName}.tool.js`);
|
|
103
|
-
|
|
103
|
+
|
|
104
104
|
// 检查工具文件是否存在
|
|
105
|
-
if (!await pathExists(toolFile)) {
|
|
105
|
+
if (!(await pathExists(toolFile))) {
|
|
106
106
|
logger.debug(`工具文件不存在,跳过: ${toolFile}`);
|
|
107
107
|
continue;
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
try {
|
|
111
111
|
// 创建目标沙箱目录
|
|
112
112
|
const sandboxDir = path.join(toolboxDir, toolName);
|
|
113
113
|
await fs.ensureDir(sandboxDir);
|
|
114
|
-
|
|
114
|
+
|
|
115
115
|
// 复制工具文件
|
|
116
116
|
const sandboxToolFile = path.join(sandboxDir, `${toolName}.tool.js`);
|
|
117
117
|
await fs.copyFile(toolFile, sandboxToolFile);
|
|
118
|
-
|
|
118
|
+
|
|
119
119
|
// 复制 README.md 文件(如果存在)
|
|
120
120
|
const readmeFile = path.join(toolDir, 'README.md');
|
|
121
121
|
if (await pathExists(readmeFile)) {
|
|
@@ -123,11 +123,11 @@ export async function syncSystemTools() {
|
|
|
123
123
|
await fs.copyFile(readmeFile, sandboxReadmeFile);
|
|
124
124
|
logger.debug(`已复制 README.md: ${toolName}`);
|
|
125
125
|
}
|
|
126
|
-
|
|
126
|
+
|
|
127
127
|
// 创建或更新 package.json
|
|
128
128
|
const packageJsonPath = path.join(sandboxDir, 'package.json');
|
|
129
129
|
let packageJson = {};
|
|
130
|
-
|
|
130
|
+
|
|
131
131
|
if (await pathExists(packageJsonPath)) {
|
|
132
132
|
// 读取现有的 package.json
|
|
133
133
|
try {
|
|
@@ -136,7 +136,7 @@ export async function syncSystemTools() {
|
|
|
136
136
|
logger.warn(`读取 package.json 失败,将重新创建: ${packageJsonPath}`, { error: error.message });
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
|
|
140
140
|
// 读取工具模块获取依赖信息
|
|
141
141
|
let dependencies = {};
|
|
142
142
|
try {
|
|
@@ -147,7 +147,7 @@ export async function syncSystemTools() {
|
|
|
147
147
|
} catch (error) {
|
|
148
148
|
logger.warn(`读取工具依赖失败: ${toolName}`, { error: error.message });
|
|
149
149
|
}
|
|
150
|
-
|
|
150
|
+
|
|
151
151
|
// 更新 package.json
|
|
152
152
|
packageJson = {
|
|
153
153
|
name: `@prompt-manager/${toolName}`,
|
|
@@ -161,30 +161,27 @@ export async function syncSystemTools() {
|
|
|
161
161
|
},
|
|
162
162
|
private: true
|
|
163
163
|
};
|
|
164
|
-
|
|
164
|
+
|
|
165
165
|
// 写入 package.json
|
|
166
166
|
await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
|
|
167
|
-
|
|
167
|
+
|
|
168
168
|
// 创建必要的子目录
|
|
169
169
|
await fs.ensureDir(path.join(sandboxDir, 'data'));
|
|
170
170
|
await fs.ensureDir(path.join(sandboxDir, 'logs'));
|
|
171
|
-
|
|
171
|
+
|
|
172
172
|
syncedCount++;
|
|
173
|
-
logger.info(`系统工具 ${toolName} 已同步到沙箱环境`, {
|
|
173
|
+
logger.info(`系统工具 ${toolName} 已同步到沙箱环境`, {
|
|
174
174
|
source: toolFile,
|
|
175
|
-
target: sandboxDir
|
|
175
|
+
target: sandboxDir
|
|
176
176
|
});
|
|
177
|
-
|
|
178
177
|
} catch (error) {
|
|
179
178
|
logger.error(`同步工具失败: ${toolName}`, { error: error.message });
|
|
180
179
|
}
|
|
181
180
|
}
|
|
182
|
-
|
|
181
|
+
|
|
183
182
|
logger.info(`系统工具同步完成,共同步 ${syncedCount} 个工具`);
|
|
184
|
-
|
|
185
183
|
} catch (error) {
|
|
186
184
|
logger.error('同步系统工具失败', { error: error.message });
|
|
187
185
|
throw error;
|
|
188
186
|
}
|
|
189
187
|
}
|
|
190
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 工具 YAML 解析服务
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* 职责:
|
|
5
5
|
* 1. 解析和规范化 YAML 配置
|
|
6
6
|
* 2. 自动修正常见的 AI 错误
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import YAML from 'yaml';
|
|
11
|
-
import { logger } from '../utils/logger.js';
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* 解析和规范化 YAML 配置
|
|
@@ -17,9 +16,9 @@ import { logger } from '../utils/logger.js';
|
|
|
17
16
|
*/
|
|
18
17
|
export function parseToolYaml(yamlInput) {
|
|
19
18
|
if (!yamlInput) {
|
|
20
|
-
throw new Error(
|
|
19
|
+
throw new Error('缺少必需参数: yaml');
|
|
21
20
|
}
|
|
22
|
-
|
|
21
|
+
|
|
23
22
|
try {
|
|
24
23
|
// Auto-correct common AI mistakes
|
|
25
24
|
let yamlContent = yamlInput.trim();
|
|
@@ -36,8 +35,8 @@ export function parseToolYaml(yamlInput) {
|
|
|
36
35
|
// Case 3: Remove @ prefix from tool URLs: @tool://xxx -> tool://xxx
|
|
37
36
|
yamlContent = yamlContent.replace(/@tool:\/\//g, 'tool://');
|
|
38
37
|
|
|
39
|
-
// Case
|
|
40
|
-
yamlContent = yamlContent.replace(/(tool|toolUrl|url):\s*"(tool:\/\/[
|
|
38
|
+
// Case 3: Remove quotes around tool URLs: tool: "tool://xxx" -> tool: tool://xxx
|
|
39
|
+
yamlContent = yamlContent.replace(/(tool|toolUrl|url):\s*"(tool:\/\/[^"]+)"/g, '$1: $2');
|
|
41
40
|
|
|
42
41
|
// YAML → JSON conversion
|
|
43
42
|
const configObj = YAML.parse(yamlContent);
|
|
@@ -49,7 +48,9 @@ export function parseToolYaml(yamlInput) {
|
|
|
49
48
|
|
|
50
49
|
// Validate required fields
|
|
51
50
|
if (!toolIdentifier) {
|
|
52
|
-
throw new Error(
|
|
51
|
+
throw new Error(
|
|
52
|
+
'Missing required field: tool\nExample: tool: tool://filesystem\nAliases supported: tool / toolUrl / url'
|
|
53
|
+
);
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
// Validate URL format
|
|
@@ -59,18 +60,19 @@ export function parseToolYaml(yamlInput) {
|
|
|
59
60
|
|
|
60
61
|
// Get tool name
|
|
61
62
|
const toolName = toolIdentifier.replace('tool://', '');
|
|
62
|
-
|
|
63
|
+
|
|
63
64
|
return {
|
|
64
65
|
toolName,
|
|
65
66
|
mode: operationMode,
|
|
66
67
|
parameters
|
|
67
68
|
};
|
|
68
|
-
|
|
69
69
|
} catch (error) {
|
|
70
70
|
// YAML parsing errors
|
|
71
71
|
if (error.name === 'YAMLException') {
|
|
72
72
|
if (error.message.includes('bad indentation') || error.message.includes('mapping entry')) {
|
|
73
|
-
throw new Error(
|
|
73
|
+
throw new Error(
|
|
74
|
+
`YAML format error: ${error.message}\n\nMultiline content requires | symbol, example:\ncontent: |\n First line\n Second line\n\nNote: Newline after |, indent content with 2 spaces`
|
|
75
|
+
);
|
|
74
76
|
}
|
|
75
77
|
throw new Error(`YAML format error: ${error.message}\nCheck indentation (use spaces) and syntax`);
|
|
76
78
|
}
|
|
@@ -78,4 +80,3 @@ export function parseToolYaml(yamlInput) {
|
|
|
78
80
|
throw error;
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
|
-
|