| 1 | package fakeclaude |
| 2 | |
| 3 | import ( |
| 4 | "strings" |
| 5 | "time" |
| 6 | ) |
| 7 | |
| 8 | // GlancePrefix opens the runner's glance prompt (thin's glancePrefix): |
| 9 | // the fake answers such a prompt as the small model would, by its |
| 10 | // newest message alone. |
| 11 | const GlancePrefix = "Write the line a person sees while their assistant starts on their message." |
| 12 | |
| 13 | // Glance answers a glance prompt: "Looking into that now", and "Looking |
| 14 | // into that again" when the conversation already held earlier turns (a |
| 15 | // glance must see the newest message alone). In the message, glanceslow |
| 16 | // takes five seconds, glancefail fails and glanceteam names the team. ok |
| 17 | // is false for any other prompt. |
| 18 | func Glance(prompt string, earlier bool) (line string, pause time.Duration, fail, ok bool) { |
| 19 | if !strings.HasPrefix(prompt, GlancePrefix) { |
| 20 | return "", 0, false, false |
| 21 | } |
| 22 | _, message, _ := strings.Cut(prompt, "<message>\n") |
| 23 | message, _, _ = strings.Cut(message, "\n</message>") |
| 24 | line = "Looking into that now" |
| 25 | if earlier { |
| 26 | line = "Looking into that again" |
| 27 | } |
| 28 | switch { |
| 29 | case strings.Contains(message, "glanceslow"): |
| 30 | pause = 5 * time.Second |
| 31 | case strings.Contains(message, "glancefail"): |
| 32 | fail = true |
| 33 | case strings.Contains(message, "glanceteam"): |
| 34 | line = "Asking the team about it" |
| 35 | } |
| 36 | return line, pause, fail, true |
| 37 | } |
| 38 | |