@yeaft/webchat-agent 0.1.28 → 0.1.29
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/crew/role-query.js +6 -1
- package/package.json +1 -1
package/crew/role-query.js
CHANGED
|
@@ -6,6 +6,7 @@ import { query, Stream } from '../sdk/index.js';
|
|
|
6
6
|
import { promises as fs } from 'fs';
|
|
7
7
|
import { join } from 'path';
|
|
8
8
|
import { getMessages } from '../crew-i18n.js';
|
|
9
|
+
import ctx from '../context.js';
|
|
9
10
|
|
|
10
11
|
/** Format role label */
|
|
11
12
|
function roleLabel(r) {
|
|
@@ -104,12 +105,16 @@ export async function createRoleQuery(session, roleName) {
|
|
|
104
105
|
// cwd 设为角色目录
|
|
105
106
|
const roleCwd = join(session.sharedDir, 'roles', roleName);
|
|
106
107
|
|
|
108
|
+
// 继承全局 MCP disallowedTools,避免不必要的 tool schema token 消耗
|
|
109
|
+
const globalDisallowed = ctx.CONFIG?.disallowedTools || [];
|
|
110
|
+
|
|
107
111
|
const queryOptions = {
|
|
108
112
|
cwd: roleCwd,
|
|
109
113
|
permissionMode: 'bypassPermissions',
|
|
110
114
|
abort: abortController.signal,
|
|
111
115
|
model: role.model || undefined,
|
|
112
|
-
appendSystemPrompt: systemPrompt
|
|
116
|
+
appendSystemPrompt: systemPrompt,
|
|
117
|
+
...(globalDisallowed.length > 0 && { disallowedTools: globalDisallowed })
|
|
113
118
|
};
|
|
114
119
|
|
|
115
120
|
if (savedSessionId) {
|