mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 12:55:51 +00:00
feat: Remote Control 条件工具注入 — PushNotification/SendUserFile/Brief 仅 bridge 启用时可用
- PushNotificationTool、SendUserFileTool 添加 isEnabled() 使用 isBridgeEnabled() - BriefTool 的 isEnabled() 从 isBriefEnabled() 改为 isBridgeEnabled() - ExecuteTool 添加 isEnabled() 兜底检查,不可用时返回友好错误 - useReplBridge bridge 首次连接时插入 system 消息通知模型新工具可用 - 移除 toolSearch 中 firstParty base URL 白名单检测,默认启用 tool search Co-Authored-By: glm-5.1[1m] <zai-org@claude-code-best.win>
This commit is contained in:
@@ -8,6 +8,7 @@ import { buildTool, type ToolDef } from 'src/Tool.js'
|
||||
import { isEnvTruthy } from 'src/utils/envUtils.js'
|
||||
import { lazySchema } from 'src/utils/lazySchema.js'
|
||||
import { plural } from 'src/utils/stringUtils.js'
|
||||
import { isBridgeEnabled } from 'src/bridge/bridgeEnabled.js'
|
||||
import { resolveAttachments, validateAttachmentPaths } from './attachments.js'
|
||||
import {
|
||||
BRIEF_TOOL_NAME,
|
||||
@@ -149,7 +150,7 @@ export const BriefTool = buildTool({
|
||||
return outputSchema()
|
||||
},
|
||||
isEnabled() {
|
||||
return isBriefEnabled()
|
||||
return isBridgeEnabled()
|
||||
},
|
||||
isConcurrencySafe() {
|
||||
return true
|
||||
|
||||
@@ -74,6 +74,21 @@ export const ExecuteTool = buildTool({
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the target tool is currently enabled
|
||||
if (!targetTool.isEnabled()) {
|
||||
return {
|
||||
data: {
|
||||
result: null,
|
||||
tool_name: input.tool_name,
|
||||
},
|
||||
newMessages: [
|
||||
createUserMessage({
|
||||
content: `工具 "${input.tool_name}" 当前不可用:Remote Control 未连接。`,
|
||||
}),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
// Check permissions on the target tool
|
||||
const permResult = await targetTool.checkPermissions?.(
|
||||
input.params as Record<string, unknown>,
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { ToolResultBlockParam } from 'src/Tool.js'
|
||||
import { buildTool } from 'src/Tool.js'
|
||||
import { lazySchema } from 'src/utils/lazySchema.js'
|
||||
import { logForDebugging } from 'src/utils/debug.js'
|
||||
import { isBridgeEnabled } from 'src/bridge/bridgeEnabled.js'
|
||||
|
||||
const PUSH_NOTIFICATION_TOOL_NAME = 'PushNotification'
|
||||
|
||||
@@ -48,6 +49,9 @@ Use this when:
|
||||
Requires Remote Control to be configured. Respects user notification settings (taskCompleteNotifEnabled, inputNeededNotifEnabled, agentPushNotifEnabled).`
|
||||
},
|
||||
|
||||
isEnabled() {
|
||||
return isBridgeEnabled()
|
||||
},
|
||||
isConcurrencySafe() {
|
||||
return true
|
||||
},
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { ToolResultBlockParam } from 'src/Tool.js'
|
||||
import { buildTool } from 'src/Tool.js'
|
||||
import { lazySchema } from 'src/utils/lazySchema.js'
|
||||
import { SEND_USER_FILE_TOOL_NAME } from './prompt.js'
|
||||
import { isBridgeEnabled } from 'src/bridge/bridgeEnabled.js'
|
||||
|
||||
const inputSchema = lazySchema(() =>
|
||||
z.strictObject({
|
||||
@@ -42,6 +43,9 @@ Guidelines:
|
||||
- Large files may take time to transfer`
|
||||
},
|
||||
|
||||
isEnabled() {
|
||||
return isBridgeEnabled()
|
||||
},
|
||||
isConcurrencySafe() {
|
||||
return true
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user