@@ -172,36 +172,42 @@ func (a *App) CurrentAgentCommands(ctx context.Context) types.Commands {
172172
173173// CurrentAgentSkills returns the available skills if skills are enabled for the current agent.
174174func (a * App ) CurrentAgentSkills () []skills.Skill {
175- if a .runtime .CurrentAgentSkillsEnabled () {
176- return skills .Load ()
175+ st := a .runtime .CurrentAgentSkillsToolset ()
176+ if st == nil {
177+ return nil
177178 }
178- return nil
179+ return st . Skills ()
179180}
180181
181182// ResolveSkillCommand checks if the input matches a skill slash command (e.g. /skill-name args).
182- // If matched, it reads the skill file and returns the resolved prompt. Otherwise returns "".
183+ // If matched, it reads the skill content and returns the resolved prompt. Otherwise returns "".
183184func (a * App ) ResolveSkillCommand (input string ) (string , error ) {
184185 if ! strings .HasPrefix (input , "/" ) {
185186 return "" , nil
186187 }
187188
189+ st := a .runtime .CurrentAgentSkillsToolset ()
190+ if st == nil {
191+ return "" , nil
192+ }
193+
188194 cmd , arg , _ := strings .Cut (input [1 :], " " )
189195 arg = strings .TrimSpace (arg )
190196
191- for _ , skill := range a . CurrentAgentSkills () {
197+ for _ , skill := range st . Skills () {
192198 if skill .Name != cmd {
193199 continue
194200 }
195201
196- content , err := os . ReadFile (skill .FilePath )
202+ content , err := st . ReadSkillContent (skill .Name )
197203 if err != nil {
198204 return "" , fmt .Errorf ("reading skill %q: %w" , skill .Name , err )
199205 }
200206
201207 if arg != "" {
202- return fmt .Sprintf ("Use the following skill.\n \n User's request: %s\n \n <skill name=%q>\n %s\n </skill>" , arg , skill .Name , string ( content ) ), nil
208+ return fmt .Sprintf ("Use the following skill.\n \n User's request: %s\n \n <skill name=%q>\n %s\n </skill>" , arg , skill .Name , content ), nil
203209 }
204- return fmt .Sprintf ("Use the following skill.\n \n <skill name=%q>\n %s\n </skill>" , skill .Name , string ( content ) ), nil
210+ return fmt .Sprintf ("Use the following skill.\n \n <skill name=%q>\n %s\n </skill>" , skill .Name , content ), nil
205211 }
206212
207213 return "" , nil
0 commit comments