+}
+
+// Work logs text as a work message of source, such as the name of a subagent,
+// and tells the clients, with status. The message starts no turn until it goes
+// to Wake.
+func (l *TurnLoop) Work(source, text, status string) (Message, error) {
+ message, err := l.memory.Append("work", text)
+ if err != nil {
+ return Message{}, err
+ }
+
+ l.notify(Event{
+ Kind: "work",
+ ID: message.ID,
+ Text: text,
+ Source: source,
+ Status: status,
+ })
+
+ return message, nil
+}
+
+// Wake adds the logged messages to the waiting messages and wakes the loop
+// once, as a user message of Submit does. They join the first request of a new
+// turn together, or the next request of a running turn after the tool results.
+func (l *TurnLoop) Wake(messages ...Message) {
+ if len(messages) == 0 {
+ return
+ }
+
+ l.mutex.Lock()
+ l.pending = append(l.pending, messages...)