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
+}