feat(skills): add reusable skill presets - #317
Open
NotToday1024 wants to merge 9 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces reusable Skills preset support across the desktop GUI and Gateway WebUI, so conversations and Cron Prompt tasks persist only a preset ID (plus a per-run disable flag) and resolve the latest preset contents at runtime—reducing unnecessary skill description exposure.
Changes:
- Adds a preset-based Skills data model (migration from legacy
skills.selectedintoDefault, deterministic normalization, missing-preset fallback). - Updates GUI/WebUI UX for Skills Hub, chat composer, and Cron Prompt tasks to select a preset or disable Skills per conversation/task.
- Extends Gateway protocol + adapters and persists per-conversation skills metadata in history (including runtime inheritance for subagents).
Reviewed changes
Copilot reviewed 60 out of 61 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/agent-gui/test/subagents/harness.mjs | Passes resolved skillsPrompt into subagent harness runtime. |
| crates/agent-gui/test/subagents/agent-tool.test.mjs | Verifies subagents inherit parent resolved Skills prompt snapshot. |
| crates/agent-gui/test/settings/normalization.test.mjs | Adds tests for preset normalization, migration, fallback, and cleanup. |
| crates/agent-gui/test/settings/automation-prompt-runner.test.mjs | Ensures Cron preset selectors display names (not internal IDs). |
| crates/agent-gui/test/chat/conversation-state.test.mjs | Updates conversation schema to v4 and tests per-conversation skills metadata retention. |
| crates/agent-gui/test/chat/chat-turn-queue.test.mjs | Ensures queued gateway turns preserve per-request preset/disable overrides. |
| crates/agent-gui/src/pages/skills-hub/SkillsHubPage.tsx | Adds preset CRUD + member selection UI and routes selections through presets. |
| crates/agent-gui/src/pages/settings/CronTaskModal.tsx | Adds preset selection + “disable Skills” toggle for prompt Cron tasks. |
| crates/agent-gui/src/pages/settings/CronSection.tsx | Wires presets into Cron modal props. |
| crates/agent-gui/src/pages/ChatPage.tsx | Uses effective skill selection per conversation; persists per-conversation skills changes. |
| crates/agent-gui/src/pages/chat/turns/runAgentConversationTurn.ts | Threads skillsPrompt into subagent runtime configuration. |
| crates/agent-gui/src/pages/chat/runtime/useSendChatTurn.ts | Resolves effective preset/disable flags per request and snapshots into prompts/tools. |
| crates/agent-gui/src/pages/chat/queue/useChatTurnQueue.ts | Propagates queued gateway preset/disable overrides into send overrides. |
| crates/agent-gui/src/pages/chat/queue/chatTurnQueue.ts | Extends queued gateway request type with preset/disable fields. |
| crates/agent-gui/src/pages/chat/hooks/useChatSkills.ts | Reconciles installed skills against all presets (removes missing skills). |
| crates/agent-gui/src/pages/chat/history/useConversationHistoryActions.ts | Loads per-conversation preset/disable metadata from history records. |
| crates/agent-gui/src/pages/chat/gateway/useGatewayBridgeListeners.ts | Applies gateway-requested preset/disable overrides when sending chat turns. |
| crates/agent-gui/src/pages/chat/gateway/gatewayBridgeTypes.ts | Extends gateway bridge types to carry preset/disable overrides. |
| crates/agent-gui/src/pages/chat/components/ChatComposerBar.tsx | Adds composer control to select preset or disable Skills for the conversation. |
| crates/agent-gui/src/lib/tools/builtinRegistry.ts | Passes skillsPrompt into subagent tool registry; removes forced skillsEnabled: false. |
| crates/agent-gui/src/lib/subagents/run.ts | Appends resolved skillsPrompt into subagent system prompt and context creation. |
| crates/agent-gui/src/lib/subagents/agentTool.ts | Adds skillsPrompt to subagent runtime config plumbing. |
| crates/agent-gui/src/lib/settings/index.ts | Introduces preset model, normalization, resolution helpers, and preset-aware updates. |
| crates/agent-gui/src/lib/chat/history/chatHistory.ts | Persists and parses skillPresetId/skillsDisabled in chat history meta (schema v4). |
| crates/agent-gui/src/lib/chat/conversation/conversationState.ts | Bumps stored meta schema to v4; includes preset/disable fields through transforms. |
| crates/agent-gui/src/lib/automation/types.ts | Adds preset/disable fields to Cron task + prompt run request types. |
| crates/agent-gui/src/i18n/config.ts | Adds i18n strings for preset selection and per-conversation/task disable labels. |
| crates/agent-gui/src/components/cron/CronPromptRunner.tsx | Builds Cron skills context using effective preset/disable selection. |
| crates/agent-gui/src-tauri/src/services/gateway/types.rs | Adds preset/disable fields to gateway chat request event struct. |
| crates/agent-gui/src-tauri/src/services/gateway/tests.rs | Updates gateway chat request test fixtures for new fields. |
| crates/agent-gui/src-tauri/src/services/gateway/envelope_handler.rs | Adds handler arm for history.skills request/response passthrough + sync publish. |
| crates/agent-gui/src-tauri/src/services/gateway/chat.rs | Wires new preset/disable fields through chat request conversion. |
| crates/agent-gui/src-tauri/src/services/gateway_bridge.rs | Adds history skills config extraction + history.skills handler. |
| crates/agent-gui/src-tauri/src/services/automation/validate.rs | Validates/preserves Cron skillPresetId and skillsDisabled fields (defaulting). |
| crates/agent-gui/src-tauri/src/services/automation/types.rs | Adds preset/disable fields and defaults to Cron task + prompt run request structs. |
| crates/agent-gui/src-tauri/src/services/automation/store.rs | Includes preset/disable fields in serialized prompt run request payload. |
| crates/agent-gui/src-tauri/src/services/automation/db.rs | Persists preset/disable fields in Cron task config JSON and row parsing. |
| crates/agent-gui/src-tauri/src/lib.rs | Registers new tauri command chat_history_set_skills. |
| crates/agent-gui/src-tauri/src/commands/history/chat_history/tests.rs | Adds tests for skills metadata patching and schema v4 expectations. |
| crates/agent-gui/src-tauri/src/commands/history/chat_history/segments.rs | Implements DB update for per-conversation preset/disable metadata (no updated_at bump). |
| crates/agent-gui/src-tauri/src/commands/history/chat_history/commands.rs | Adds tauri command + gateway sync publish for history skills updates. |
| crates/agent-gateway/web/test/gateway-v2-adapters.test.mjs | Tests new history.skills envelope encoding and chat command field mapping. |
| crates/agent-gateway/web/test/conversation-skills-state.test.mjs | Tests client-side “dirty override” state machine for skills selections. |
| crates/agent-gateway/web/src/pages/skills-hub/SkillsHubPage.tsx | Mirrors GUI preset management UI and preset-aware skill selection behavior. |
| crates/agent-gateway/web/src/pages/settings/CronTaskModal.tsx | Mirrors GUI Cron preset selection + disable toggle. |
| crates/agent-gateway/web/src/pages/settings/CronSection.tsx | Wires presets into WebUI Cron modal props. |
| crates/agent-gateway/web/src/pages/chat/useChatSkills.ts | Reconciles installed skills against all presets (WebUI). |
| crates/agent-gateway/web/src/pages/chat/ChatComposerBar.tsx | Adds WebUI composer preset selector + per-chat disable option. |
| crates/agent-gateway/web/src/lib/settings/index.ts | Adds WebUI preset model + normalization/resolution helpers mirroring GUI. |
| crates/agent-gateway/web/src/lib/gatewayTypes.ts | Exposes history detail skill preset/disable fields in WebUI types. |
| crates/agent-gateway/web/src/lib/gatewaySocketV2/adapters.ts | Adds history.skills request mapping and response decoding support. |
| crates/agent-gateway/web/src/lib/gatewaySocket.ts | Adds setHistorySkills API and includes preset/disable on chat commands. |
| crates/agent-gateway/web/src/lib/chat/conversationSkillsState.ts | Implements WebUI client-side per-conversation skills override tracking + dirty reconciliation. |
| crates/agent-gateway/web/src/lib/automation/types.ts | Adds preset/disable fields to WebUI Cron task type. |
| crates/agent-gateway/web/src/i18n/config.ts | Adds WebUI i18n strings for preset selection and disable labels. |
| crates/agent-gateway/web/src/app/GatewayApp.tsx | Tracks per-conversation preset/disable state, persists via gateway, uses effective selection. |
| crates/agent-gateway/proto/v2/gateway.proto | Adds proto fields/messages for preset/disable on chat + history get/prefix + history.skills. |
| crates/agent-gateway/internal/protocol/pbws/guard.go | Allows history.skills request through guard. |
| crates/agent-gateway/internal/protocol/pbws/guard_test.go | Tests history.skills is permitted by guard. |
| crates/agent-gateway/internal/proto/v2/gateway.pb.go | Regenerated Go bindings for new proto fields/messages. |
Files not reviewed (1)
- crates/agent-gateway/internal/proto/v2/gateway.pb.go: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
我感觉预设加在斜杠命令中选择会不会好一些,提示词输入框底部已经很挤了 |
Contributor
Author
|
已按建议调整(099fe8b):会话输入框底部的常驻方案选择器已移除,改为类似 Codex CLI |
# Conflicts: # crates/agent-gateway/internal/proto/v2/gateway.pb.go # crates/agent-gateway/internal/protocol/pbws/guard_test.go # crates/agent-gateway/proto/v2/gateway.proto # crates/agent-gateway/web/src/lib/proto/gen/proto/v2/gateway_pb.ts
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.
关联 Issue
Closes #306
需求说明
增加可复用的 Skill 预设。Skills Hub 负责预设及成员管理;不同会话和 Cron Prompt 任务可选择不同预设,运行时只向模型暴露该预设内的 Skill 信息,减少无关 Skill description。
主要改动
Skills Hub 与设置
skills.selected。会话与 Cron
/model的/skills命令选择 Default、自定义预设或“本会话关闭”,不增加常驻输入框控件。Gateway 与持久化
代码改动范围
agent-gui/src/lib/settings,gateway/web/src/lib/settingspages/skills-hub,components/skillspages/chat, GUI queue/runtime/skills、关闭、排队与 prompt 解析src-tauri/commands/historyagent-gateway, GUI gateway servicesagent-gui/src/lib/subagents当前相对
origin/main@b6d6231:71 个文件,约+4330/-389;生成的 Go/TS Proto 文件包含在范围内。截图预览
已安装页:Default 与已启用 Skill 保持一致
Skill 预设:与安装、导入等功能平级的卡片入口
Default 只读详情
自定义预设编辑器:说明、搜索、类别过滤与启用开关
会话
/skills命令与预设列表Cron Prompt 预设选择
预设生命周期与关闭状态
空态
创建并编辑名称、说明和成员
重命名、复制与删除确认
单会话与单 Cron 关闭 Skills
Gateway WebUI 对应界面
已安装页与预设页
自定义预设编辑器
/skills与 Cron共 22 张当前实现截图,覆盖 GUI 与真实 Gateway WebUI 的新增 UI 和主要交互状态。
验证
1406/1406495/49514/14go test ./...2/228/2856/56290/290HistorySkillsResponse=98buf lint/ breaking checkgit diff --check/ Go/Rust format真实 Playwright 操作额外发现并修复了“输入新预设名称时读取失效 React event 导致页面崩溃”的问题;当前截图流程已覆盖输入、保存和再次进入编辑器。
基线测试说明
Rust 全量测试仍暴露主线既有问题:4 个 Git/worktree 断言失败,以及 3 个 terminal 测试在当前 PTY 中终止测试进程。对应实现文件未被本 PR 修改,并与
origin/main一致,因此不混入本功能 PR。兼容性
skills.selected自动迁移到 Default。Review 建议顺序
/skills、Cron UI 和截图。提交前检查
origin/main@b6d6231的冲突。HistorySkillsResponse使用空闲 Proto tag98,保留上游 Chat Ingress95-97。2fea3b0已推送,GitHub 已重新计算为MERGEABLE、无基线冲突。