X-Git-Url: http://git.giacomolli.uk/onechat/blobdiff_plain/e1e48ba388c28105fff3b70c8ca02304f5d57f53..47f69638bc96100f2e446f63c7c3689023156e64:/stop.go?ds=inline diff --git a/stop.go b/stop.go index 640464f..6df8dd3 100644 --- a/stop.go +++ b/stop.go @@ -1,4 +1,21 @@ package main -// stopCommand is the input line that interrupts the running turn. +import ( + "strings" +) + +// stopCommand is the input line that interrupts the running turn. The line +// "/stop NAME" stops the subagent NAME. const stopCommand = "/stop" + +// stopSubagentName returns NAME of a line "/stop NAME", or false for any other +// line. +func stopSubagentName(line string) (string, bool) { + name, found := strings.CutPrefix(strings.TrimSpace(line), stopCommand+" ") + name = strings.TrimSpace(name) + if !found || name == "" { + return "", false + } + + return name, true +}