]> git.giacomolli.uk - onechat/blobdiff - turn.go
Check the socket path before the daemon writes
[onechat] / turn.go
diff --git a/turn.go b/turn.go
index 75cbfb6478a4934e6e5172009fcbad718f22ef5b..f8faad83d0a8be375b4e9fd3b2f9e6766284d2cf 100644 (file)
--- a/turn.go
+++ b/turn.go
@@ -17,8 +17,8 @@ type modelClient interface {
 }
 
 // Event tells the clients what the agent does as it happens. Kind is the kind
 }
 
 // Event tells the clients what the agent does as it happens. Kind is the kind
-// of a logged message (user, reply, tool, echo), or one of busy, idle, and
-// error. ID is the ID of a logged message.
+// of a logged message (user, reply, tool, echo), or one of ready, busy, idle,
+// and error. ID is the ID of a logged message.
 type Event struct {
        Kind string `json:"kind"`
        ID   int    `json:"id,omitempty"`
 type Event struct {
        Kind string `json:"kind"`
        ID   int    `json:"id,omitempty"`
@@ -133,6 +133,14 @@ func (l *loop) Interrupt() bool {
        return true
 }
 
        return true
 }
 
+// Busy tells if a turn runs.
+func (l *loop) Busy() bool {
+       l.mutex.Lock()
+       defer l.mutex.Unlock()
+
+       return l.cancel != nil
+}
+
 // Append logs a message and tells the clients. The toolbox logs its calls and
 // results through it.
 func (l *loop) Append(kind, text string) (Message, error) {
 // Append logs a message and tells the clients. The toolbox logs its calls and
 // results through it.
 func (l *loop) Append(kind, text string) (Message, error) {