From 169a09506bb24c4fb947a1c40282d494bf628964 Mon Sep 17 00:00:00 2001 From: matevip Date: Fri, 1 May 2026 09:48:46 +0800 Subject: [PATCH] feat(skill): detail drawer + Agent Tool Advanced fold --- mateclaw-ui/src/i18n/locales/en-US.ts | 13 ++ mateclaw-ui/src/i18n/locales/zh-CN.ts | 13 ++ mateclaw-ui/src/types/index.ts | 73 +++++++++++ mateclaw-ui/src/views/Agents.vue | 66 +++++++--- mateclaw-ui/src/views/SkillMarket.vue | 170 ++++++++++++++++++++++++++ 5 files changed, 316 insertions(+), 19 deletions(-) diff --git a/mateclaw-ui/src/i18n/locales/en-US.ts b/mateclaw-ui/src/i18n/locales/en-US.ts index 40dce031..35b99736 100644 --- a/mateclaw-ui/src/i18n/locales/en-US.ts +++ b/mateclaw-ui/src/i18n/locales/en-US.ts @@ -772,6 +772,8 @@ export default { binding: { skillsHint: 'Select skills this agent can use. Leave empty to use all enabled skills.', toolsHint: 'Select tools this agent can use. Leave empty to use all enabled tools.', + advancedToolsTitle: 'Advanced: Hand-picked atomic tools', + advancedToolsHint: 'Skill bindings already auto-expand allowed tools. Use this only for built-in micro-utilities not packaged as a skill (e.g. datetime, delegate_agent).', providersHint: 'Preferred provider order for this agent (lower index tried first). Leave empty to use the global available-pool order. Cooling-down or pool-removed providers are still skipped automatically.', providersAddHint: 'Click a provider below to add it to the preference list:', noSkills: 'No skills available', @@ -1930,10 +1932,21 @@ export default { }, actions: { configure: 'Configure', + view: 'View', delete: 'Delete', saveChanges: 'Save Changes', createSkill: 'Create Skill', }, + detail: { + title: 'Skill detail', + manifest: 'Manifest', + tools: 'Tools', + features: 'Features', + noManifest: 'This skill does not declare a v3 manifest. Legacy fields apply.', + noTools: 'No tools advertised by active features.', + noFeatures: 'No features[] matrix declared. The skill is treated as a single default feature.', + toolsHint: 'These tool names are merged into the LLM allowed-tool list when this skill is bound to an agent. Tools owned by SETUP_NEEDED features stay hidden.', + }, runtime: { disabled: 'Disabled', unknown: 'Unknown', diff --git a/mateclaw-ui/src/i18n/locales/zh-CN.ts b/mateclaw-ui/src/i18n/locales/zh-CN.ts index 5fbcdecb..8eb97ca4 100644 --- a/mateclaw-ui/src/i18n/locales/zh-CN.ts +++ b/mateclaw-ui/src/i18n/locales/zh-CN.ts @@ -772,6 +772,8 @@ export default { binding: { skillsHint: '选择此智能体可使用的技能。留空则使用所有已启用的技能。', toolsHint: '选择此智能体可使用的工具。留空则使用所有已启用的工具。', + advancedToolsTitle: '高级:手选原子工具', + advancedToolsHint: 'Skill 绑定已自动展开 allowed-tools。此处仅用于未打包成 Skill 的内置微工具(如 datetime、delegate_agent)。', providersHint: '此智能体优先使用的提供商顺序(数字越小越先尝试)。留空则按全局可用池顺序回退。提供商进入冷却或被移出池时仍会被自动跳过。', providersAddHint: '点击下方提供商加入偏好列表:', noSkills: '暂无可用技能', @@ -1932,10 +1934,21 @@ export default { }, actions: { configure: '配置', + view: '查看', delete: '删除', saveChanges: '保存更改', createSkill: '创建技能', }, + detail: { + title: '技能详情', + manifest: 'Manifest', + tools: '工具', + features: '特性', + noManifest: '该技能未声明 v3 manifest,使用旧字段。', + noTools: '当前激活特性未暴露任何工具。', + noFeatures: '未声明 features[] 矩阵,技能被视为单一默认特性。', + toolsHint: 'Skill 绑定到 agent 时,这些工具名将合并进 LLM 的 allowed-tools。SETUP_NEEDED 特性下的工具保持隐藏。', + }, runtime: { disabled: '已停用', unknown: '未知', diff --git a/mateclaw-ui/src/types/index.ts b/mateclaw-ui/src/types/index.ts index 40ada216..3f9213c9 100644 --- a/mateclaw-ui/src/types/index.ts +++ b/mateclaw-ui/src/types/index.ts @@ -233,6 +233,8 @@ export interface Skill { /** 运行时解析状态(来自 /runtime/status) */ export interface SkillRuntimeStatus { + /** RFC-090 Phase 2 — entity primary key */ + id?: number name: string description?: string source: string // "directory" | "database" @@ -256,6 +258,77 @@ export interface SkillRuntimeStatus { dependencySummary?: string | null // Computed label runtimeStatusLabel?: string + // RFC-090 §14.1 — features matrix + manifest SoT + manifest?: SkillManifest | null + /** Map */ + featureStatuses?: Record + /** featureIds whose status is READY */ + activeFeatures?: string[] + /** Tools advertised to the LLM after feature filtering */ + effectiveAllowedTools?: string[] +} + +/** RFC-090 §14.6 — typed view onto manifest_json */ +export interface SkillManifest { + id?: string + name?: string + description?: string + icon?: string + version?: string + author?: string + /** prompt | code | mcp | acp | knowledge */ + type?: string + category?: string + allowedTools?: string[] + requires?: SkillManifestRequirement[] + platforms?: string[] + features?: SkillManifestFeature[] + settings?: SkillManifestSetting[] + requiresModel?: string[] + dashboardMetrics?: SkillManifestDashboardMetric[] + selfEvolution?: { lessonsEnabled?: boolean; lessonsMaxEntries?: number; memoryWritesAllowed?: boolean } + knowledge?: { + bindKb?: string + retrieval?: string + topK?: number + citation?: string + rerank?: boolean + boundKbId?: number | null + } | null + extras?: Record +} + +export interface SkillManifestRequirement { + key: string + type?: string + check?: string + optional?: boolean + description?: string + install?: Record +} + +export interface SkillManifestFeature { + id: string + label?: string + requires?: string[] + platforms?: string[] + tools?: string[] + fallbackMessage?: string + unsupportedMessage?: string +} + +export interface SkillManifestSetting { + key: string + label?: string + type?: string + defaultValue?: any + options?: Record[] +} + +export interface SkillManifestDashboardMetric { + label?: string + memoryKey?: string + format?: string } /** 安全扫描发现 */ diff --git a/mateclaw-ui/src/views/Agents.vue b/mateclaw-ui/src/views/Agents.vue index 44989d5f..c48bf950 100644 --- a/mateclaw-ui/src/views/Agents.vue +++ b/mateclaw-ui/src/views/Agents.vue @@ -243,26 +243,39 @@ - +
-

{{ t('agents.binding.toolsHint') }}

-
{{ t('agents.binding.noTools') }}
-
- -
+
+ + + {{ t('agents.binding.advancedToolsTitle') }} + {{ selectedToolNames.length }} + + {{ (advancedToolsOpen || selectedToolNames.length > 0) ? '▾' : '▸' }} + +

{{ t('agents.binding.toolsHint') }}

+

{{ t('agents.binding.advancedToolsHint') }}

+
{{ t('agents.binding.noTools') }}
+
+ +
+
@@ -324,6 +337,10 @@ const activeFilter = ref('all') const showModal = ref(false) const editingAgent = ref(null) const modalTab = ref<'basic' | 'skills' | 'tools' | 'providers'>('basic') +/** RFC-090 §9.2 调整 B — Tool picker is an Advanced bypass; collapsed by + * default but stays open as soon as the agent has any direct tool + * bindings, so existing users don't lose visibility on their picks. */ +const advancedToolsOpen = ref(false) // Binding state const availableSkills = ref([]) @@ -868,4 +885,15 @@ async function toggleAgent(agent: Agent) { .template-tags { display: flex; flex-wrap: wrap; gap: 4px; align-self: flex-start; margin-top: 2px; } .tag-chip { font-size: 11px; padding: 2px 8px; background: var(--mc-bg-sunken); color: var(--mc-text-tertiary); border-radius: 999px; white-space: nowrap; } + +/* RFC-090 §9.2 调整 B — Advanced Tools picker (collapsed by default) */ +.advanced-tools { border: 1px dashed var(--mc-border); border-radius: 12px; padding: 0; } +.advanced-tools[open] { padding: 12px 14px; } +.advanced-tools-summary { list-style: none; cursor: pointer; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; user-select: none; color: var(--mc-text-secondary); font-size: 13px; font-weight: 600; } +.advanced-tools-summary::-webkit-details-marker { display: none; } +.advanced-tools[open] > .advanced-tools-summary { padding: 0 0 8px; border-bottom: 1px solid var(--mc-border-light); margin-bottom: 8px; } +.advanced-tools-title { display: inline-flex; align-items: center; gap: 8px; } +.advanced-tools-count { padding: 1px 8px; background: var(--mc-primary-bg); color: var(--mc-primary); border-radius: 999px; font-size: 11px; font-weight: 700; } +.advanced-tools-chevron { color: var(--mc-text-tertiary); font-size: 12px; } +.advanced-tools-note { font-style: italic; color: var(--mc-text-tertiary); margin-top: 4px; } diff --git a/mateclaw-ui/src/views/SkillMarket.vue b/mateclaw-ui/src/views/SkillMarket.vue index 7a171956..6510f2cf 100644 --- a/mateclaw-ui/src/views/SkillMarket.vue +++ b/mateclaw-ui/src/views/SkillMarket.vue @@ -114,6 +114,10 @@ {{ getDependencyBadge(skill)?.label }} + + + {{ getFeaturesBadge(skill)?.label }} + {{ getSourceBadge(skill) }} {{ getRuntimePath(skill) }} @@ -179,6 +183,12 @@ + +