标题: Google短信也接入Gemini了吗
作者: #agi_is_coming
板块: #搞七捻三
编号:
帖子: https://linux.do/t/topic/1928537
时间: 2026-04-09 11:04:16
摘要:
作者: #agi_is_coming
板块: #搞七捻三
编号:
1928537帖子: https://linux.do/t/topic/1928537
时间: 2026-04-09 11:04:16
摘要:
小米17刷的eea系统,今天突然弹出这个信息。
有没有用过的佬
标题: 反重力炸了吗
作者: #饺子汤
板块: #开发调优
编号:
帖子: https://linux.do/t/topic/1928538
时间: 2026-04-09 11:04:18
摘要:
作者: #饺子汤
板块: #开发调优
编号:
1928538帖子: https://linux.do/t/topic/1928538
时间: 2026-04-09 11:04:18
摘要:
反重力炸了?一直无法问问题,软件没有任何反应
标题: 【模块 3】工具系统 — 架构设计分析
作者: #维寒
板块: #开发调优
编号:
帖子: https://linux.do/t/topic/1928540
时间: 2026-04-09 11:04:25
摘要:
作者: #维寒
板块: #开发调优
编号:
1928540帖子: https://linux.do/t/topic/1928540
时间: 2026-04-09 11:04:25
摘要:
【模块 3】工具系统 — 架构设计分析
核心架构:工具系统设计
前置概念:理解工具(Tool)
是什么:
工具 = LLM 可调用的函数
LLM 决定"做什么",工具负责"实际执行"
每个工具包含:输入 Schema、执行逻辑、权限检查、UI 渲染
类比:
就像"手机 App",LLM 是用户,工具是 App,用户说"我要打车"→ 打开打车 App → App 执行叫车流程
工具系统架构
%%{init: {'theme': 'neutral'}}%%
flowchart TB
subgraph L1[1. 工具定义层 Tool.ts]
A1[Tool 类型定义]
A2[buildTool 工厂函数]
A3[ToolUseContext 工具执行上下文]
end
subgraph L2[2. 工具注册层 tools.ts]
B1[工具导入与组织]
B2[特征门控 条件启用]
B3[工具池合并 内置/技能/MCP]
end
subgraph L3[3. 工具实现层 tools/]
C1[文件系统 FileRead FileWrite FileEdit]
C2[网络 WebFetch WebSearch]
C3[执行 Bash PowerShell AgentTool]
C4[集成 MCP LSP Skill]
C5[协作 Task Team SendMessage]
end
subgraph L4[4. 权限检查层 permissions/]
D1[hasPermissionsToUseTool]
D2[5 层决策]
D3[权限规则解析与匹配]
end
subgraph L5[5. UI 渲染层 tools/*/UI.tsx]
E1[工具使用消息渲染]
E2[进度反馈]
E3[结果展示]
end
L1 --> L2 --> L3 --> L4 --> L5
5 层权限检查流程图
%%{init: {'theme': 'neutral'}}%%
flowchart TB
A[工具调用请求] --> B[hasPermissionsToUseTool]
B --> C[第1层: 配置权限 alwaysAllow?]
B --> D[第2层: 分类器 Bash分类器预测]
B --> E[第3层: 协调器 Coordinator模式]
C --> F{允许?}
D --> G{高置信度?}
E --> H{委托处理?}
F -->|是| I[允许执行]
F -->|否| J[第4层: Swarm模式]
G -->|是| I
G -->|否| J
H -->|是| K[按规则决策]
H -->|否| J
J --> L{有规则?}
L -->|是| M[邮件桥请求]
L -->|否| N[第5层: 交互式 PermissionRequest]
K --> O{允许?}
M --> O
N --> P{用户选择}
O -->|allow| I
O -->|deny| Q[拒绝]
P -->|allow| I
P -->|deny| Q
工具调用时序图
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant L as LLM
participant Q as QueryEngine
participant T as Tool.ts
participant P as Permission
participant I as ToolImpl
participant U as UI
L->>Q: tool_use
Q->>T: canUseTool()
T->>P: 检查配置权限
alt 允许
P-->>T: 5 层决策 allow
T-->>Q: allow
Q->>I: execute()
I->>I: 执行工具逻辑
I->>U: 进度更新
U-->>I: 渲染进度
I-->>Q: tool_result
Q-->>L: continue
else 拒绝
P-->>T: deny
T-->>Q: deny
Q-->>L: permission_denied
end
1. Tool.ts:工具类型定义
文件结构
类型/函数
职责
Tool
工具基础类型(输入/输出/权限/UI)
buildTool()
工具构建工厂函数
ToolUseContext
工具执行上下文
ToolPermissionContext
权限上下文
CanUseToolFn
权限检查函数类型
核心设计
Tool 类型定义
type Tool = {
// 基础信息
name: string
searchHint: string
maxResultSizeChars: number
// Schema
inputSchema: z.ZodSchema
outputSchema?: z.ZodSchema
// 描述与提示
description: () => Promise<string>
prompt: () => Promise<string>
userFacingName: (input: any) => string
// 权限检查
checkPermissions: (input, context) => Promise<PermissionDecision>
preparePermissionMatcher: (input) => Promise<(pattern: string) => boolean>
// UI 渲染
renderToolUseMessage: (input) => React.ReactNode
renderToolResultMessage: (result) => React.ReactNode
renderToolUseProgressMessage?: (progress) => React.ReactNode
// 执行
execute: (input, context) => Promise<ToolResult>
// 辅助函数
getPath?: (input) => string
toAutoClassifierInput?: (input) => string
backfillObservableInput?: (input) => void
}
核心算法
算法 1:buildTool 工厂函数
要解决的问题:
如何统一工具定义,减少样板代码?
通俗解释:
1. 接收工具配置对象
2. 填充默认值(如 strict: true)
3. 验证必需字段(name, inputSchema, execute)
4. 返回标准化工具对象
代码结构:
export function buildTool<T extends Tool>(config: Partial<T>): T {
return {
// 默认值
strict: true,
maxResultSizeChars: 100_000,
// 用户配置
...config,
// 强制字段验证
name: config.name ?? throw Error('name required'),
inputSchema: config.inputSchema ?? throw Error('inputSchema required'),
execute: config.execute ?? throw Error('execute required'),
} as T
}
设计亮点:
类型安全:TypeScript 泛型约束
默认值:减少重复代码
验证:确保必需字段存在
2. tools.ts:工具注册表
文件结构
函数
职责
get
标题: gpt5.4实在是有点放飞自我了
作者: #ikb
板块: #开发调优
编号:
帖子: https://linux.do/t/topic/1928541
时间: 2026-04-09 11:04:30
摘要:
作者: #ikb
板块: #开发调优
编号:
1928541帖子: https://linux.do/t/topic/1928541
时间: 2026-04-09 11:04:30
摘要:
只跑了3分钟就跑出这么多金句,现在每天不吸点gpt5.4的神经气质就浑身不舒服。
标题: Codex似乎明天重置,是不是说今天可以猛蹬了
作者: #Minty
板块: #前沿快讯
编号:
帖子: https://linux.do/t/topic/1928542
时间: 2026-04-09 11:04:38
摘要:
作者: #Minty
板块: #前沿快讯
编号:
1928542帖子: https://linux.do/t/topic/1928542
时间: 2026-04-09 11:04:38
摘要:
codex重置预告
他真的,我哭死,提前通知大家
标题: 不是发个评论现在也要审核了吗?
作者: #不韦
板块: #搞七捻三
编号:
帖子: https://linux.do/t/topic/1928544
时间: 2026-04-09 11:04:39
摘要:
作者: #不韦
板块: #搞七捻三
编号:
1928544帖子: https://linux.do/t/topic/1928544
时间: 2026-04-09 11:04:39
摘要:
如图,这其中也没有任何敏感词吧,而且我打字的途中帐号还意外自动退出了一次
标题: [Stop] 停止水Trae Solo贴
作者: #ozer_23
板块: #福利羊毛
编号:
帖子: https://linux.do/t/topic/1928545
时间: 2026-04-09 11:04:48
摘要:
作者: #ozer_23
板块: #福利羊毛
编号:
1928545帖子: https://linux.do/t/topic/1928545
时间: 2026-04-09 11:04:48
摘要:
各位新人和大佬,为什么每个人都喜欢单独开一份trae solo贴呢,然后单独的帖子所有人领了就走并没有接力,帖子也没有活力,太多信息量低的内容了。请管理员@neo 可以提醒一下
标题: vscode升级1.114后worktree不见了
作者: #cymorian
板块: #搞七捻三
编号:
帖子: https://linux.do/t/topic/1928546
时间: 2026-04-09 11:04:49
摘要:
作者: #cymorian
板块: #搞七捻三
编号:
1928546帖子: https://linux.do/t/topic/1928546
时间: 2026-04-09 11:04:49
摘要:
如题,习惯性手残点了更新,结果worktree全都没了。
然后,保险起见,先回退到了v1.108。
刚才看到1.115又出来了,我就不试了,毕竟主力在claude code,vscode只是偶尔看看git。
标题: [薄荷公益]签到头奖,今天运气有的爆
作者: #pengblgy
板块: #搞七捻三
编号:
帖子: https://linux.do/t/topic/1928566
时间: 2026-04-09 11:06:58
摘要:
作者: #pengblgy
板块: #搞七捻三
编号:
1928566帖子: https://linux.do/t/topic/1928566
时间: 2026-04-09 11:06:58
摘要:
注册俩月,第一次大奖。
标题: trae solo 邀请码,国内国际
作者: #速度搞起
板块: #福利羊毛
编号:
帖子: https://linux.do/t/topic/1928575
时间: 2026-04-09 11:07:34
摘要:
作者: #速度搞起
板块: #福利羊毛
编号:
1928575帖子: https://linux.do/t/topic/1928575
时间: 2026-04-09 11:07:34
摘要:
solo.trae.ai
TRAE SOLO: More Than Coding
solo.trae.cn
TRAE SOLO: More Than Coding
标题: 人生 是一个 loop……
作者: #🥒
板块: #搞七捻三
编号:
帖子: https://linux.do/t/topic/1928576
时间: 2026-04-09 11:07:35
摘要:
作者: #🥒
板块: #搞七捻三
编号:
1928576帖子: https://linux.do/t/topic/1928576
时间: 2026-04-09 11:07:35
摘要:
对的对的……
@MIKUSCAT 会喜欢的剧情
鼠鼠……要被被太阳晒坏了啊