@@ -19,7 +19,7 @@ public protocol FileSyncDaemon: ObservableObject {
1919
2020@MainActor
2121public class MutagenDaemon : FileSyncDaemon {
22- private let logger = Logger ( subsystem: Bundle . main. bundleIdentifier!, category: " mutagen " )
22+ let logger = Logger ( subsystem: Bundle . main. bundleIdentifier!, category: " mutagen " )
2323
2424@Published public var state : DaemonState = . stopped{
2525 didSet{
@@ -42,9 +42,9 @@ public class MutagenDaemon: FileSyncDaemon {
4242private let mutagenDaemonSocket : URL
4343
4444 // Non-nil when the daemon is running
45+ var client : DaemonClient ?
4546private var group : MultiThreadedEventLoopGroup ?
4647private var channel : GRPCChannel ?
47- private var client : DaemonClient ?
4848
4949 // Protect start & stop transitions against re-entrancy
5050private let transition = AsyncSemaphore ( value: 1 )
@@ -171,7 +171,8 @@ public class MutagenDaemon: FileSyncDaemon {
171171)
172172 client= DaemonClient (
173173 mgmt: Daemon_DaemonAsyncClient ( channel: channel!) ,
174- sync: Synchronization_SynchronizationAsyncClient ( channel: channel!)
174+ sync: Synchronization_SynchronizationAsyncClient ( channel: channel!) ,
175+ prompt: Prompting_PromptingAsyncClient ( channel: channel!)
175176)
176177 logger. info (
177178" Successfully connected to mutagen daemon, socket: \( self . mutagenDaemonSocket. path, privacy: . public) "
@@ -301,6 +302,7 @@ public class MutagenDaemon: FileSyncDaemon {
301302struct DaemonClient {
302303let mgmt : Daemon_DaemonAsyncClient
303304let sync : Synchronization_SynchronizationAsyncClient
305+ let prompt : Prompting_PromptingAsyncClient
304306}
305307
306308public enum DaemonState {
@@ -342,6 +344,8 @@ public enum DaemonError: Error {
342344case connectionFailure( Error )
343345case terminatedUnexpectedly
344346case grpcFailure( Error )
347+ case invalidGrpcResponse( String )
348+ case unexpectedStreamClosure
345349
346350public var description : String {
347351switch self {
@@ -355,6 +359,10 @@ public enum DaemonError: Error {
355359" The daemon must be started first "
356360case let . grpcFailure( error) :
357361" Failed to communicate with daemon: \( error) "
362+ case let . invalidGrpcResponse( response) :
363+ " Invalid gRPC response: \( response) "
364+ case . unexpectedStreamClosure:
365+ " Unexpected stream closure "
358366}
359367}
360368