fix(worker): start_list_handler ehrlich machen, wenn keine App verbunden ist
ConnectedClientTracker zaehlt verbundene UI-Clients (WorkerHub.OnConnectedAsync/ OnDisconnectedAsync). StartListHandler prueft ihn vor dem Broadcast und liefert bei 0 verbundenen Clients Requested=false plus Reason statt unbedingtem true. Tool-Beschreibung und external-mcp.md an das reale Verhalten angepasst.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
namespace ClaudeDo.Worker.Hub;
|
||||
|
||||
/// <summary>
|
||||
/// Counts SignalR clients (the ClaudeDo App) currently connected to <see cref="WorkerHub"/>.
|
||||
/// A <c>Hub</c> instance is transient per connection, so this lives as a DI singleton and is
|
||||
/// updated from <see cref="WorkerHub.OnConnectedAsync"/>/<see cref="WorkerHub.OnDisconnectedAsync"/>
|
||||
/// — the only way an out-of-band caller (external MCP's start_list_handler, which only
|
||||
/// broadcasts) can tell whether anything is listening before claiming it did something.
|
||||
/// </summary>
|
||||
public sealed class ConnectedClientTracker
|
||||
{
|
||||
private int _count;
|
||||
|
||||
public bool AnyConnected => Volatile.Read(ref _count) > 0;
|
||||
|
||||
public void Increment() => Interlocked.Increment(ref _count);
|
||||
|
||||
public void Decrement() => Interlocked.Decrement(ref _count);
|
||||
}
|
||||
Reference in New Issue
Block a user