Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/OpenClaw.CommandPalette/Pages/OpenClawPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ public override IListItem[] GetItems()
Title = "💬 Web Chat",
Subtitle = "Open the OpenClaw chat window"
},
new ListItem(new OpenUrlCommand("openclaw://send"))
{
Title = "📝 Quick Send",
Subtitle = "Send a message to OpenClaw"
},
new ListItem(new OpenUrlCommand("openclaw://setup"))
{
Title = "🧭 Setup Wizard",
Expand Down
78 changes: 0 additions & 78 deletions src/OpenClaw.Shared/OpenClawGatewayClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2252,84 +2252,6 @@ internal static string ResolveEffectiveSessionKey(
return null;
}

public string BuildMissingScopeFixCommands(string missingScope)
{
var scope = string.IsNullOrWhiteSpace(missingScope) ? "operator.write" : missingScope.Trim();
var grantedScopes = _grantedOperatorScopes.Length == 0
? "(none reported by gateway)"
: string.Join(", ", _grantedOperatorScopes);
var deviceId = string.IsNullOrWhiteSpace(_operatorDeviceId)
? "(not reported for this operator connection)"
: _operatorDeviceId;
var likelyNodeToken = _grantedOperatorScopes.Any(s => s.StartsWith("node.", StringComparison.OrdinalIgnoreCase));

var sb = new StringBuilder();
sb.AppendLine("Quick Send is connected, but your token is missing required permission.");
sb.AppendLine($"Missing scope: {scope}");
sb.AppendLine("Note: requested connect scopes are declarative; the gateway may grant fewer scopes based on token/policy/device state.");
sb.AppendLine();
sb.AppendLine("Do this in Windows Tray right now:");
sb.AppendLine("1. Right-click the tray icon and open Settings.");
sb.AppendLine("2. Replace Gateway Token with an OPERATOR token that includes operator.write.");
sb.AppendLine("3. Click Save.");
sb.AppendLine("4. Reconnect from the tray menu (or restart the tray app).");
sb.AppendLine("5. Retry Quick Send.");
sb.AppendLine();
sb.AppendLine("Token requirements for Quick Send:");
sb.AppendLine("- Role: operator");
sb.AppendLine("- Required scope: operator.write");
sb.AppendLine("- Recommended scopes: operator.admin, operator.read, operator.approvals, operator.pairing, operator.write");

if (likelyNodeToken)
{
sb.AppendLine();
sb.AppendLine("Detected node.* scopes. This usually means a node token was pasted into Gateway Token.");
sb.AppendLine("Quick Send requires an operator token, not a node token.");
}

sb.AppendLine();
sb.AppendLine("Connection details from this app (for debugging/support):");
sb.AppendLine($"- role: operator");
sb.AppendLine($"- client.id: {OperatorClientId}");
sb.AppendLine($"- client.displayName: {OperatorClientDisplayName}");
sb.AppendLine($"- operator device id: {deviceId}");
sb.AppendLine($"- granted scopes: {grantedScopes}");
sb.AppendLine();
sb.AppendLine("If this still fails after updating the token, copy this block and share it with your gateway admin.");
return sb.ToString().TrimEnd();
}

public string BuildPairingApprovalFixCommands()
{
var deviceId = !string.IsNullOrWhiteSpace(_operatorDeviceId)
? _operatorDeviceId
: _deviceIdentity.DeviceId;
var grantedScopes = _grantedOperatorScopes.Length == 0
? "(none reported by gateway yet)"
: string.Join(", ", _grantedOperatorScopes);

var sb = new StringBuilder();
sb.AppendLine("Quick Send requires this device to be approved (paired) in the gateway.");
sb.AppendLine("Gateway reported: pairing required");
sb.AppendLine();
sb.AppendLine("Do this now:");
sb.AppendLine("1. Open the gateway admin UI.");
sb.AppendLine("2. Go to pending pairing/device approvals.");
sb.AppendLine("3. Approve this Windows tray device ID.");
sb.AppendLine("4. Return to tray and reconnect (or restart tray app).");
sb.AppendLine("5. Retry Quick Send.");
sb.AppendLine();
sb.AppendLine("Connection details from this app (for debugging/support):");
sb.AppendLine("- role: operator");
sb.AppendLine($"- client.id: {OperatorClientId}");
sb.AppendLine($"- client.displayName: {OperatorClientDisplayName}");
sb.AppendLine($"- operator device id: {deviceId}");
sb.AppendLine($"- granted scopes: {grantedScopes}");
sb.AppendLine();
sb.AppendLine("If approval keeps failing, share this block with your gateway admin.");
return sb.ToString().TrimEnd();
}

private void HandleEvent(JsonElement root, int rawMessageLength)
{
if (!root.TryGetProperty("event", out var eventProp)) return;
Expand Down
76 changes: 3 additions & 73 deletions src/OpenClaw.Tray.WinUI/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
SshTunnelCommandLine.CanForwardBrowserProxyPort(_settings.SshTunnelRemotePort, _settings.SshTunnelLocalPort);
if (_settings.NodeBrowserProxyEnabled && !includeBrowserProxyForward)
{
Logger.Warn("SSH tunnel browser proxy forward disabled because the derived port would be invalid");

Check warning on line 103 in src/OpenClaw.Tray.WinUI/App.xaml.cs

View workflow job for this annotation

GitHub Actions / test

The type 'Logger' in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs' conflicts with the imported type 'Logger' in 'OpenClawTray.FunctionalUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs'.

Check warning on line 103 in src/OpenClaw.Tray.WinUI/App.xaml.cs

View workflow job for this annotation

GitHub Actions / test

The type 'Logger' in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs' conflicts with the imported type 'Logger' in 'OpenClawTray.FunctionalUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs'.

Check warning on line 103 in src/OpenClaw.Tray.WinUI/App.xaml.cs

View workflow job for this annotation

GitHub Actions / build (win-arm64)

The type 'Logger' in 'C:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs' conflicts with the imported type 'Logger' in 'OpenClawTray.FunctionalUI, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'C:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs'.

Check warning on line 103 in src/OpenClaw.Tray.WinUI/App.xaml.cs

View workflow job for this annotation

GitHub Actions / build (win-arm64)

The type 'Logger' in 'C:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs' conflicts with the imported type 'Logger' in 'OpenClawTray.FunctionalUI, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'C:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs'.

Check warning on line 103 in src/OpenClaw.Tray.WinUI/App.xaml.cs

View workflow job for this annotation

GitHub Actions / build (win-x64)

The type 'Logger' in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs' conflicts with the imported type 'Logger' in 'OpenClawTray.FunctionalUI, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs'.

Check warning on line 103 in src/OpenClaw.Tray.WinUI/App.xaml.cs

View workflow job for this annotation

GitHub Actions / build (win-x64)

The type 'Logger' in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs' conflicts with the imported type 'Logger' in 'OpenClawTray.FunctionalUI, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs'.
}

_sshTunnelService.EnsureStarted(
Expand Down Expand Up @@ -242,7 +242,6 @@
// Windows (created on demand)
private HubWindow? _hubWindow;
private TrayMenuWindow? _trayMenuWindow;
private QuickSendDialog? _quickSendDialog;
private ChatWindow? _chatWindow;
private ConnectionStatusWindow? _connectionStatusWindow;

Expand Down Expand Up @@ -291,7 +290,7 @@
if (allowedLocales.Contains(langOverride.ToLowerInvariant()))
LocalizationHelper.SetLanguageOverride(langOverride);
else
Logger.Warn($"[App] Ignoring invalid OPENCLAW_LANGUAGE value: {langOverride}");

Check warning on line 293 in src/OpenClaw.Tray.WinUI/App.xaml.cs

View workflow job for this annotation

GitHub Actions / test

The type 'Logger' in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs' conflicts with the imported type 'Logger' in 'OpenClawTray.FunctionalUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs'.

Check warning on line 293 in src/OpenClaw.Tray.WinUI/App.xaml.cs

View workflow job for this annotation

GitHub Actions / build (win-arm64)

The type 'Logger' in 'C:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs' conflicts with the imported type 'Logger' in 'OpenClawTray.FunctionalUI, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'C:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs'.

Check warning on line 293 in src/OpenClaw.Tray.WinUI/App.xaml.cs

View workflow job for this annotation

GitHub Actions / build (win-arm64)

The type 'Logger' in 'C:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs' conflicts with the imported type 'Logger' in 'OpenClawTray.FunctionalUI, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'C:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs'.

Check warning on line 293 in src/OpenClaw.Tray.WinUI/App.xaml.cs

View workflow job for this annotation

GitHub Actions / build (win-x64)

The type 'Logger' in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs' conflicts with the imported type 'Logger' in 'OpenClawTray.FunctionalUI, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs'.

Check warning on line 293 in src/OpenClaw.Tray.WinUI/App.xaml.cs

View workflow job for this annotation

GitHub Actions / build (win-x64)

The type 'Logger' in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs' conflicts with the imported type 'Logger' in 'OpenClawTray.FunctionalUI, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs'.
}

InitializeComponent();
Expand Down Expand Up @@ -328,7 +327,7 @@
s_runMarker.MarkEnded();
try
{
Logger.Info($"Process exiting (ExitCode={Environment.ExitCode})");

Check warning on line 330 in src/OpenClaw.Tray.WinUI/App.xaml.cs

View workflow job for this annotation

GitHub Actions / test

The type 'Logger' in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs' conflicts with the imported type 'Logger' in 'OpenClawTray.FunctionalUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs'.

Check warning on line 330 in src/OpenClaw.Tray.WinUI/App.xaml.cs

View workflow job for this annotation

GitHub Actions / build (win-arm64)

The type 'Logger' in 'C:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs' conflicts with the imported type 'Logger' in 'OpenClawTray.FunctionalUI, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'C:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs'.

Check warning on line 330 in src/OpenClaw.Tray.WinUI/App.xaml.cs

View workflow job for this annotation

GitHub Actions / build (win-arm64)

The type 'Logger' in 'C:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs' conflicts with the imported type 'Logger' in 'OpenClawTray.FunctionalUI, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'C:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs'.

Check warning on line 330 in src/OpenClaw.Tray.WinUI/App.xaml.cs

View workflow job for this annotation

GitHub Actions / build (win-x64)

The type 'Logger' in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs' conflicts with the imported type 'Logger' in 'OpenClawTray.FunctionalUI, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs'.

Check warning on line 330 in src/OpenClaw.Tray.WinUI/App.xaml.cs

View workflow job for this annotation

GitHub Actions / build (win-x64)

The type 'Logger' in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs' conflicts with the imported type 'Logger' in 'OpenClawTray.FunctionalUI, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'D:\a\openclaw-windows-node\openclaw-windows-node\src\OpenClaw.Tray.WinUI\Services\Logger.cs'.
}
catch { }
}
Expand Down Expand Up @@ -639,7 +638,6 @@
if (_settings.GlobalHotkeyEnabled)
{
_globalHotkey = new GlobalHotkeyService();
_globalHotkey.HotkeyPressed += OnGlobalHotkeyPressed;
_globalHotkey.VoiceHotkeyPressed += OnVoiceHotkeyPressed;
_globalHotkey.SettingsHotkeyPressed += OnSettingsHotkeyPressed;
_globalHotkey.Register();
Expand Down Expand Up @@ -922,7 +920,7 @@
else
ShowHub();
break;
case "quicksend": ShowQuickSend(); break;
case "quicksend": break; // Quick Send removed
case "history": ShowHub("channels"); break;
case "activity": ShowHub("channels"); break;
case "healthcheck": _ = RunHealthCheckAsync(userInitiated: true); break;
Expand Down Expand Up @@ -2472,7 +2470,6 @@
_hubWindow = new HubWindow();
_hubWindow.AppModel = _appState;
_hubWindow.ApplyNavPaneState(_settings!);
_hubWindow.QuickSendAction = () => ShowQuickSend();
_hubWindow.OpenSetupAction = () => _ = ShowOnboardingAsync();
_hubWindow.OpenConnectionStatusAction = ShowConnectionStatusWindow;
_hubWindow.OpenVoiceAction = () => ShowHub("voice"); // was: ShowVoiceOverlay()
Expand Down Expand Up @@ -2613,8 +2610,8 @@
if (_settings!.GlobalHotkeyEnabled)
{
_globalHotkey ??= new GlobalHotkeyService();
_globalHotkey.HotkeyPressed -= OnGlobalHotkeyPressed;
_globalHotkey.HotkeyPressed += OnGlobalHotkeyPressed;
_globalHotkey.VoiceHotkeyPressed -= OnVoiceHotkeyPressed;
_globalHotkey.VoiceHotkeyPressed += OnVoiceHotkeyPressed;
_globalHotkey.SettingsHotkeyPressed -= OnSettingsHotkeyPressed;
_globalHotkey.SettingsHotkeyPressed += OnSettingsHotkeyPressed;
_globalHotkey.Register();
Expand Down Expand Up @@ -2664,54 +2661,6 @@
ShowHub("chat");
}

private void ShowQuickSend(string? prefillMessage = null)
{
if (_connectionManager?.OperatorClient == null)
{
Logger.Warn("QuickSend blocked: gateway client not initialized");
return;
}

try
{
// Keep a strong reference to the window; otherwise the dialog can be GC'd
// and appear to not open (especially when triggered from a hotkey).
if (_quickSendDialog != null)
{
// If caller wants a prefill, re-create to apply it.
if (!string.IsNullOrEmpty(prefillMessage))
{
try { _quickSendDialog.Close(); } catch { }
_quickSendDialog = null;
}
else
{
Logger.Info("QuickSend dialog already open; activating");
_quickSendDialog.ShowAsync();
return;
}
}

Logger.Info("Showing QuickSend dialog");
// Bug #3: pass a Func that resolves the live OperatorClient on
// every Send so post-pair / restart / reinit swaps are observed.
var dialog = new QuickSendDialog(() => _connectionManager?.OperatorClient as OpenClawGatewayClient, prefillMessage);
dialog.Closed += (s, e) =>
{
if (ReferenceEquals(_quickSendDialog, dialog))
{
_quickSendDialog = null;
}
};
_quickSendDialog = dialog;
dialog.ShowAsync();
}
catch (Exception ex)
{
Logger.Error($"Failed to show QuickSend dialog: {ex.Message}");
}
}

private void ShowStatusDetail()
{
ShowHub("connection");
Expand Down Expand Up @@ -3026,7 +2975,6 @@
}
void IAppCommands.ShowVoiceOverlay() => ShowHub("voice");
void IAppCommands.ShowChat() => ShowChatWindow();
void IAppCommands.ShowQuickSend() => ShowQuickSend();
void IAppCommands.CheckForUpdates() => _ = CheckForUpdatesUserInitiatedAsync();
void IAppCommands.ShowOnboarding() => _ = ShowOnboardingAsync();
void IAppCommands.ShowConnectionStatus() => ShowConnectionStatusWindow();
Expand Down Expand Up @@ -3119,21 +3067,6 @@
}
}

private void OnGlobalHotkeyPressed(object? sender, EventArgs e)
{
if (_dispatcherQueue == null)
{
Logger.Warn("Hotkey pressed but DispatcherQueue is null");
return;
}

var enqueued = _dispatcherQueue.TryEnqueue(() => ShowQuickSend());
if (!enqueued)
{
Logger.Warn("Hotkey pressed but failed to enqueue QuickSend on UI thread");
}
}

private void OnVoiceHotkeyPressed(object? sender, EventArgs e)
{
if (_dispatcherQueue == null) return;
Expand Down Expand Up @@ -3793,7 +3726,6 @@
OpenActivityStream = ShowActivityStream,
OpenNotificationHistory = ShowNotificationHistory,
OpenDashboard = OpenDashboard,
OpenQuickSend = ShowQuickSend,
OpenHub = (page) => ShowHub(page),
OpenVoice = () => ShowHub("voice"), // was: ShowVoiceOverlay()
StopVoice = () => _ = StopVoiceAsync(),
Expand Down Expand Up @@ -3980,8 +3912,6 @@
SafeShutdownStep("chat window", () => { _chatWindow?.ForceClose(); _chatWindow = null; });
SafeShutdownStep("tray menu window", () => CloseWindow(_trayMenuWindow));
_trayMenuWindow = null;
SafeShutdownStep("quick send dialog", () => CloseWindow(_quickSendDialog));
_quickSendDialog = null;
SafeShutdownStep("keep alive window", () => CloseWindow(_keepAliveWindow));
_keepAliveWindow = null;

Expand Down
Loading
Loading