Skip to content

Commit 1d83639

Browse files
sytoneCopilot
andauthored
feat: SSH tunnel gateway, device identity, reconnect hardening
Adds SSH local port-forward support for secure remote gateway access, Ed25519 device identity for operator auth, enhanced Quick Send with error remediation, reconnect resilience, and OpenClaw.Cli validator tool. Includes security fix: SSH user/host input validation to prevent command injection. 615 tests pass (516 shared + 99 tray). Contributed by @sytone Co-authored-by: Copilot <[email protected]>
1 parent 4e7225b commit 1d83639

27 files changed

Lines changed: 51635 additions & 84 deletions

‎AGENTS.md‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# AGENTS.md
2+
3+
## Required Validation After Every Change
4+
5+
All agents working in this repository must run validation after each code change before marking work complete.
6+
7+
Required steps:
8+
9+
1. Run full repo build:
10+
- `./build.ps1`
11+
2. Run shared tests:
12+
- `dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore`
13+
3. Run tray tests:
14+
- `dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore`
15+
16+
If a command fails:
17+
18+
1. Fix the issue.
19+
2. Re-run the failed command.
20+
3. Re-run all required validation commands before completion.
21+
22+
Notes:
23+
24+
- If a build/test is blocked by an environmental lock (for example running executable locking output assemblies), stop/close the locking process and rerun.
25+
- Do not claim completion without reporting validation results.

‎README.md‎

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ A Windows companion suite for [OpenClaw](https://openclaw.ai) - the AI-powered p
1010

1111
## Projects
1212

13-
This monorepo contains three projects:
13+
This monorepo contains four projects:
1414

1515
| Project | Description |
1616
|---------|-------------|
1717
| **OpenClaw.Tray.WinUI** | System tray application (WinUI 3) for quick access to OpenClaw |
1818
| **OpenClaw.Shared** | Shared gateway client library |
19+
| **OpenClaw.Cli** | CLI validator for WebSocket connect/send/probe using tray settings |
1920
| **OpenClaw.CommandPalette** | PowerToys Command Palette extension |
2021

2122
## 🚀 Quick Start
@@ -67,6 +68,24 @@ dotnet build src/OpenClaw.Tray.WinUI -r win-x64 -p:PackageMsix=true # x64 MSI
6768
.\src\OpenClaw.Tray.WinUI\bin\Debug\net10.0-windows10.0.19041.0\win-x64\OpenClaw.Tray.WinUI.exe # x64
6869
```
6970

71+
### Run CLI WebSocket Validator
72+
73+
Use the CLI to validate gateway connectivity and `chat.send` outside the tray UI.
74+
75+
```powershell
76+
# Show help
77+
dotnet run --project src/OpenClaw.Cli -- --help
78+
79+
# Use tray settings from %APPDATA%\OpenClawTray\settings.json and send one message
80+
dotnet run --project src/OpenClaw.Cli -- --message "quick send validation"
81+
82+
# Loop sends and also probe sessions/usage/nodes APIs
83+
dotnet run --project src/OpenClaw.Cli -- --repeat 5 --delay-ms 1000 --probe-read --verbose
84+
85+
# Override gateway URL/token for isolated testing
86+
dotnet run --project src/OpenClaw.Cli -- --url ws://127.0.0.1:18789 --token "<token>" --message "override test"
87+
```
88+
7089
## 📦 OpenClaw.Tray (Molty)
7190

7291
Modern Windows 11-style system tray companion that connects to your local OpenClaw gateway.
@@ -87,6 +106,20 @@ Modern Windows 11-style system tray companion that connects to your local OpenCl
87106
- ⚙️ **Settings** - Full configuration dialog
88107
- 🎯 **First-run experience** - Welcome dialog guides new users
89108

109+
#### Quick Send scope requirement
110+
111+
Quick Send uses the gateway `chat.send` method and requires the operator device to have `operator.write` scope.
112+
113+
If Quick Send fails with `missing scope: operator.write`, Molty now copies identity + remediation guidance to your clipboard, including:
114+
115+
- operator role and `client.id` used by the tray app
116+
- gateway-reported operator device id (if provided)
117+
- currently granted scopes (if provided)
118+
119+
For this specific error (`missing scope: operator.write`), the cause is an **operator token scope issue**. Update the token used by the tray app so it includes `operator.write`, then retry Quick Send.
120+
121+
If Quick Send fails with `pairing required` / `NOT_PAIRED`, that is a **device approval** issue. Approve the tray device in gateway pairing approvals, reconnect, and retry.
122+
90123
### Menu Sections
91124
- **Status** - Gateway connection status with click-to-view details
92125
- **Sessions** - Active agent sessions with preview and per-session controls

‎build.ps1‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Builds all projects, checks prerequisites, and provides clear guidance.
77
88
.PARAMETER Project
9-
Which project to build: All, Tray, WinUI, Shared, CommandPalette
9+
Which project to build: All, Tray, WinUI, Shared, CommandPalette, Cli
1010
Default: All
1111
1212
.PARAMETER Configuration
@@ -23,7 +23,7 @@
2323
#>
2424

2525
param(
26-
[ValidateSet("All", "Tray", "WinUI", "Shared", "CommandPalette")]
26+
[ValidateSet("All", "Tray", "WinUI", "Shared", "CommandPalette", "Cli")]
2727
[string]$Project = "All",
2828

2929
[ValidateSet("Debug", "Release")]
@@ -187,12 +187,13 @@ function Build-Project($name, $path, $useRid = $false) {
187187

188188
$projects = @{
189189
"Shared" = @{ Path = "src/OpenClaw.Shared/OpenClaw.Shared.csproj"; UseRid = $false }
190+
"Cli" = @{ Path = "src/OpenClaw.Cli/OpenClaw.Cli.csproj"; UseRid = $false }
190191
"Tray" = @{ Path = "src/OpenClaw.Tray.WinUI/OpenClaw.Tray.WinUI.csproj"; UseRid = $true }
191192
"WinUI" = @{ Path = "src/OpenClaw.Tray.WinUI/OpenClaw.Tray.WinUI.csproj"; UseRid = $true }
192193
"CommandPalette" = @{ Path = "src/OpenClaw.CommandPalette/OpenClaw.CommandPalette.csproj"; UseRid = $false }
193194
}
194195

195-
$toBuild = if ($Project -eq "All") { @("Shared", "WinUI") } else { @($Project) }
196+
$toBuild = if ($Project -eq "All") { @("Shared", "Cli", "WinUI") } else { @($Project) }
196197

197198
# Always build Shared first if building other projects
198199
if ($Project -ne "Shared" -and $Project -ne "All" -and $toBuild -notcontains "Shared") {

0 commit comments

Comments
 (0)