@yeaft/webchat-agent 0.1.810 → 0.1.812
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/claude.js +8 -4
- package/crew/role-query.js +5 -2
- package/package.json +1 -1
package/claude.js
CHANGED
|
@@ -102,15 +102,19 @@ export async function startClaudeQuery(conversationId, workDir, resumeSessionId)
|
|
|
102
102
|
// 配置 SDK query 选项
|
|
103
103
|
const options = {
|
|
104
104
|
cwd: workDir,
|
|
105
|
-
|
|
105
|
+
// 不显式设 permissionMode(让它走 SDK 默认 'default')。
|
|
106
|
+
// bypassPermissions 会让 CLI 跳过整个 permission 通道,但我们注册了
|
|
107
|
+
// canCallTool(→ --permission-prompt-tool stdio)来拦截
|
|
108
|
+
// AskUserQuestion;新版 Claude CLI 在 bypass+stdio 同时存在时会
|
|
109
|
+
// 卡在 init 握手 / message_start 后死等。改用 default mode +
|
|
110
|
+
// canCallTool 自动放行,是新 CLI 期望的形态。
|
|
106
111
|
abort: abortController.signal,
|
|
107
|
-
// 拦截 AskUserQuestion 工具调用,转发到 Web UI
|
|
112
|
+
// 拦截 AskUserQuestion 工具调用,转发到 Web UI;其他工具自动放行
|
|
108
113
|
canCallTool: async (toolName, input, toolCtx) => {
|
|
109
114
|
if (toolName === 'AskUserQuestion') {
|
|
110
115
|
return await handleAskUserQuestion(conversationId, input, toolCtx);
|
|
111
116
|
}
|
|
112
|
-
|
|
113
|
-
return input;
|
|
117
|
+
return { behavior: 'allow', updatedInput: input };
|
|
114
118
|
}
|
|
115
119
|
};
|
|
116
120
|
|
package/crew/role-query.js
CHANGED
|
@@ -160,7 +160,10 @@ async function _createRoleQueryInner(session, roleName) {
|
|
|
160
160
|
|
|
161
161
|
const queryOptions = {
|
|
162
162
|
cwd: roleCwd,
|
|
163
|
-
permissionMode
|
|
163
|
+
// 不设 permissionMode(走 SDK 默认 'default')。bypassPermissions +
|
|
164
|
+
// canCallTool 在新版 Claude CLI 会卡死 init 握手 / message_start。
|
|
165
|
+
// canCallTool 在 default 模式下能正常工作,并对非 AskUserQuestion
|
|
166
|
+
// 工具返回 { behavior:'allow', updatedInput } 等同放行。
|
|
164
167
|
abort: abortController.signal,
|
|
165
168
|
model: role.model || undefined,
|
|
166
169
|
appendSystemPrompt: systemPrompt,
|
|
@@ -177,7 +180,7 @@ async function _createRoleQueryInner(session, roleName) {
|
|
|
177
180
|
if (toolName === 'AskUserQuestion') {
|
|
178
181
|
return await handleAskUserQuestion(session.id, input, toolCtx);
|
|
179
182
|
}
|
|
180
|
-
return input;
|
|
183
|
+
return { behavior: 'allow', updatedInput: input };
|
|
181
184
|
};
|
|
182
185
|
|
|
183
186
|
if (savedSessionId) {
|