feat: Agent Profile 全局配置体系(Phase 1-2)#249
Open
SheldonLiu0412 wants to merge 1 commit intoErlichLiu:mainfrom
Open
feat: Agent Profile 全局配置体系(Phase 1-2)#249SheldonLiu0412 wants to merge 1 commit intoErlichLiu:mainfrom
SheldonLiu0412 wants to merge 1 commit intoErlichLiu:mainfrom
Conversation
引入 Agent Profile 作为独立全局实体,支持角色定义、模型配置、MCP/Skills 精确过滤。 核心功能: - AgentProfile 数据模型与 CRUD(agents.json 全局存储) - 基于 symlink 的 Skill 精确过滤(临时 plugin 目录 + 缓存复用) - Profile 级 MCP 服务器精确加载(空数组 = 不使用) - QuickTask(Option+Space)@ mention 选择 Agent,内联 mention 标签 - 会话级 Agent 配置注入(channel/model/thinking/effort/budget/turns/additionalPrompt) - 配置优先级:会话输入 > Agent Profile > 全局默认 - 设置页 Agents Tab:emoji picker、chip 能力选择、折叠高级选项、骨架屏 Bug 修复: - QuickTask @agent 发起的会话模型选择器未正确显示 - 会话内手动切换模型被 agent 配置覆盖 安全加固: - profileId UUID 格式校验防路径穿越 - symlink 目标路径校验防目录逃逸 - 并发构建锁防止同 profile 竞态重建
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Agent 角色
Agent 模式独立的角色配置体系,实现按角色精确分配能力和任务:
具体修改
数据层(4 文件)
packages/shared/src/types/agent.ts— 新增 AgentProfile 类型定义、IPC 通道常量、CRUD 输入类型apps/electron/src/main/lib/agent-profile-service.ts— 新文件,AgentProfile CRUD + 预置通用助手初始化apps/electron/src/main/lib/config-paths.ts— 新增getAgentProfilePluginDir(含 UUID 格式校验)apps/electron/src/main/ipc.ts— 注册 Agent Profile 的 5 个 IPC handler + LIST_ALL_CAPABILITIES编排层(1 文件)
apps/electron/src/main/lib/agent-orchestrator.tsbuildProfileMcpServers()— 按 Profile 精确加载 MCP 服务器buildProfilePluginDir()— 基于 symlink 的 Skill 精确过滤 + 缓存复用 + 并发锁渲染层(10 文件)
AgentSelector.tsx— 新文件,会话输入框的 Agent 选择器组件AgentView.tsx— 集成 per-session profile/channel/model map,pendingPrompt 同步QuickTaskApp.tsx— @ mention 触发弹窗(mirror div 精确定位、键盘导航、内联 mention 标签)AgentProfileSettings.tsx— 新文件,设置页 Agents 列表(骨架屏、能力 badge、builtin 标识)AgentProfileForm.tsx— 新文件,Agent 编辑表单(emoji picker、chip 能力选择、折叠高级选项)SettingsPanel.tsx— Agent 模式下注册 Agents TabGlobalShortcuts.tsx— QuickTask 提交时注入 Agent Profile 配置agent-atoms.ts— 新增agentSessionProfileMapAtomsettings-tab.ts— 新增'agents'tab IDmain.tsx/index.ts/preload/index.ts/types/settings.ts— 启动初始化 + IPC bridge审查情况
3 个 SubAgent 并行审查(主进程/渲染层/设置页 UI),共发现 4 Critical + 12 Warning + 6 Nit
profileIdUUID 正则校验防路径穿越resolve()+startsWith()防目录逃逸pluginBuildLocksSet 防同 profile 并发重建竞态测试结果
bun run typecheck通过