MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / CollectInlineSkillRuntime

Function CollectInlineSkillRuntime

skills/runtime.go:54–100  ·  view source on GitHub ↗
(messages []map[string]any)

Source from the content-addressed store, hash-verified

52}
53
54func CollectInlineSkillRuntime(messages []map[string]any) InlineSkillRuntime {
55 var effectiveAllow map[string]struct{}
56 var hasAllow bool
57 var model *string
58 var effort any
59 disable := false
60 for _, message := range messages {
61 metadata, _ := message["metadata"].(map[string]any)
62 if metadata["source"] != SkillInlineSource {
63 continue
64 }
65 if rawAllowed, exists := metadata[SkillInlineAllowedToolsKey]; exists && rawAllowed != nil {
66 allowed := map[string]struct{}{}
67 for _, name := range stringSlice(rawAllowed) {
68 if name != "" {
69 allowed[name] = struct{}{}
70 }
71 }
72 if !hasAllow {
73 effectiveAllow = allowed
74 hasAllow = true
75 } else {
76 for name := range effectiveAllow {
77 if _, ok := allowed[name]; !ok {
78 delete(effectiveAllow, name)
79 }
80 }
81 }
82 }
83 if rawModel, ok := metadata["lumina_skill_model"].(string); ok && rawModel != "" {
84 model = &rawModel
85 }
86 if rawEffort, ok := metadata["lumina_skill_effort"]; ok && rawEffort != nil {
87 effort = rawEffort
88 }
89 if metadata[SkillInlineDisableSkillToolKey] == true {
90 disable = true
91 }
92 }
93 var allowedList []string
94 if hasAllow {
95 for name := range effectiveAllow {
96 allowedList = append(allowedList, name)
97 }
98 }
99 return InlineSkillRuntime{HasAllowedTools: hasAllow, AllowedToolNames: allowedList, ModelOverride: model, Effort: effort, DisableSkillTool: disable}
100}
101
102func stringSlice(raw any) []string {
103 switch values := raw.(type) {

Calls 1

stringSliceFunction · 0.85