SkillCommandFork returns (skillName, task, true) when input is a slash command for a `context: fork` skill, otherwise (_, _, false). Chat layers must call this before ResolveInput and route to RunSkillFork on a hit.
(_ context.Context, input string)
| 315 | // command for a `context: fork` skill, otherwise (_, _, false). Chat layers |
| 316 | // must call this before ResolveInput and route to RunSkillFork on a hit. |
| 317 | func (a *App) SkillCommandFork(_ context.Context, input string) (skillName, task string, ok bool) { |
| 318 | if !strings.HasPrefix(input, "/") { |
| 319 | return "", "", false |
| 320 | } |
| 321 | |
| 322 | st := a.runtime.CurrentAgentSkillsToolset() |
| 323 | if st == nil { |
| 324 | return "", "", false |
| 325 | } |
| 326 | |
| 327 | cmd, arg, _ := strings.Cut(input[1:], " ") |
| 328 | arg = strings.TrimSpace(arg) |
| 329 | |
| 330 | for _, skill := range st.Skills() { |
| 331 | if skill.Name != cmd { |
| 332 | continue |
| 333 | } |
| 334 | if !skill.IsFork() { |
| 335 | return "", "", false |
| 336 | } |
| 337 | return skill.Name, arg, true |
| 338 | } |
| 339 | |
| 340 | return "", "", false |
| 341 | } |
| 342 | |
| 343 | // RunSkillFork dispatches a fork-mode skill in an isolated sub-session of |
| 344 | // the current parent. The parent gains a SubSession item once the runtime |