Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: Avoid snapshots when loading skills https://github.com/siyuan-note/siyuan/issues/17797

Daniel8c8247174a09
diff --git a/kernel/agent/tools_test.go b/kernel/agent/tools_test.go
index 7b926efa9f..9942d01b29 100644
--- a/kernel/agent/tools_test.go
+++ b/kernel/agent/tools_test.go
@@ -160,6 +160,19 @@ func TestImageToolActionEffects(t *testing.T) {
}
}
+func TestSkillToolActionEffects(t *testing.T) {
+ for _, action := range []string{"", "load", "list"} {
+ if needsConfirm("skill", action, nil) || needsLocalSnapshot("skill", action) {
+ t.Errorf("read-only skill action %q must not require confirmation or create a snapshot", action)
+ }
+ }
+ for _, action := range []string{"save", "install", "remove", "rename"} {
+ if !needsConfirm("skill", action, nil) || !needsLocalSnapshot("skill", action) {
+ t.Errorf("write skill action %q must require confirmation and create a snapshot", action)
+ }
+ }
+}
+
func TestQueryToolActionEffects(t *testing.T) {
tests := []struct {
toolName string
diff --git a/kernel/mcp/tools/skill.go b/kernel/mcp/tools/skill.go
index 9f056c1239..01d7d71cc4 100644
--- a/kernel/mcp/tools/skill.go
+++ b/kernel/mcp/tools/skill.go
@@ -38,6 +38,16 @@ var SkillTool = &Tool{
},
Required: []string{"action"},
},
+ EffectScope: EffectScopeLocal,
+ ActionEffects: map[string]ToolEffects{
+ "": {LocalRead: true},
+ "load": {LocalRead: true},
+ "save": {LocalWrite: true},
+ "install": {LocalWrite: true},
+ "remove": {LocalWrite: true},
+ "rename": {LocalWrite: true},
+ "list": {LocalRead: true},
+ },
Handler: skillHandler,
}