You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b5d8acb
Browse filesBrowse the repository at this point in the historyBrowse files
| ui-dispatcher | authoritative | src/OpenClaw.Tray.WinUI/App.xaml.cs | UI-thread marshaling abstraction for presentation code | IUiDispatcher | App and existing WinUI code may call DispatcherQueue directly until the view-model migration | presentation view models depend on IUiDispatcher not a concrete DispatcherQueue | UiDispatcherContractTests.PageViewModel_ReceivesRegisteredDispatcher | behavioral | - |
123
+
| navigation-scope | authoritative | src/OpenClaw.Tray.WinUI/Windows/HubWindow.xaml.cs | page view-model activation/deactivation and disposal lifetime | NavigationScopeManager | HubWindow keeps frame navigation back-stack and rail selection | transient page view models are activated on navigation and deactivated then disposed on navigate-away | NavigationScopeManagerTests.NavigatingAway_DeactivatesAndDisposesPreviousViewModel | behavioral | - |
124
+
| composition-root | authoritative | src/OpenClaw.Tray.WinUI/App.xaml.cs | presentation-layer service construction and wiring | AppServiceRegistration | App remains the composition root and owns non-DI service lifetimes | one validated root ServiceProvider; App-owned singletons registered as instances are never disposed by the container | AppServiceRegistrationTests.Dispose_DoesNotDisposeAppOwnedInstanceSingletons | behavioral | - |
**OpenClaw.Shared** owns the low-level gateway clients (`OpenClawGatewayClient`, `WindowsNodeClient`, `WebSocketClientBase`), device identity/signing (`DeviceIdentity`), protocol models, and the `IOperatorGatewayClient` interface.
18
18
19
+
`WindowsNodeClient` also owns gateway invocation lifetime at the transport
20
+
boundary. Active invokes are registered by invoke ID in a focused cancellation
21
+
registry, linked to the node connection lifetime, and cancelled individually by
22
+
the gateway `node.invoke.cancel` event. Active invocations atomically transition
23
+
to cancelled or completed when capability execution returns; whichever
24
+
transition wins determines the protocol outcome. Capability implementations
25
+
remain responsible for cooperative cancellation of their own underlying work.
26
+
19
27
**OpenClaw.Connection** owns all connection management: `GatewayConnectionManager`, `GatewayRegistry`, `CredentialResolver`, `ConnectionStateMachine`, `NodeConnector`, `SshTunnelService/Manager`, `SetupCodeDecoder`, and all connection interfaces/DTOs/enums. This project has zero WinUI dependencies and is independently testable.
20
28
21
29
**OpenClaw.Tray.WinUI** consumes the connection layer through interfaces. It never creates gateway clients directly — `GatewayConnectionManager` owns that entirely.
Copy file name to clipboardExpand all lines: docs/MCP_MODE.md
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,9 +66,37 @@ The capability list lives on `NodeService`, *not* on `WindowsNodeClient`. That s
66
66
-`tools/list` — flattens `_capabilities` into MCP tools. Tool name = command name (`"screen.snapshot"`); known commands get curated descriptions from `McpToolBridge.CommandDescriptions`; unknown commands fall back to `"{category} capability: {command}"`. `inputSchema` is permissive.
67
67
-`tools/call` — finds the capability via `INodeCapability.CanHandle(name)`, builds a `NodeInvokeRequest` (the same struct the gateway path uses), calls `ExecuteAsync`, wraps the result as MCP `content[].text`. Tool failures come back as `result.isError = true`, not JSON-RPC errors (per MCP spec — JSON-RPC errors are reserved for protocol issues).
-`notifications/cancelled` — cancels the active request whose JSON-RPC ID is
70
+
supplied as `params.requestId`. A cancelled `tools/call` completes with an MCP
71
+
tool error containing `cancelled`. If concurrent HTTP scheduling processes
72
+
cancellation just before an already-sent call registers, the notification
73
+
records a pending cancellation for five seconds. The first matching
74
+
registration atomically consumes that tombstone and returns `cancelled` before
75
+
capability execution begins, so correctness does not depend on scheduler
76
+
timing. Repeated notifications for the same pending ID do not extend its
77
+
original five-second lifetime. Pending cancellations and recent-completion
78
+
guards are each capped at 1,024 entries;
79
+
expired entries are pruned first and the oldest remaining entry is evicted at
80
+
capacity. Because JSON-RPC IDs are client-scoped but this stateless HTTP
81
+
transport has no client identity, duplicate active IDs are allowed and
82
+
cancellation is ignored when more than one active call matches; this prevents
83
+
one local client from cancelling another client when the collision is already
84
+
observable. Request matching uses the decoded JSON string value or normalized
85
+
arbitrary-precision JSON number value, while preserving the distinction
86
+
between string and numeric IDs. A tombstone cannot predict a later
87
+
cross-client ID collision, so it cancels the first matching registration;
88
+
complete isolation would require client identity in the transport. A recent
89
+
completion guard also prevents a late notification from poisoning immediate
90
+
ID reuse.
69
91
70
92
The bridge takes a `Func<IReadOnlyList<INodeCapability>>` rather than a snapshot. Every `tools/list` re-reads the live list. This is what guarantees zero-cost capability addition — register a new capability after server start and it appears on the next `tools/list`.
71
93
94
+
Cancellation is cooperative and uses the same `CancellationToken` capability
95
+
contract as the gateway transport. Screen and camera operations propagate the
96
+
token through recording consent/countdown, camera admission, capture waits, and
97
+
recording shutdown. The HTTP request deadline remains a separate safety bound;
98
+
no command-specific transport deadlines are applied.
99
+
72
100
### HTTP transport
73
101
74
102
`OpenClaw.Shared/Mcp/McpHttpServer.cs` is `System.Net.HttpListener` bound to `http://127.0.0.1:8765/`. Loopback-only by construction; not reachable from any other machine even with firewall holes. A defensive `IPAddress.IsLoopback` check on each request acts as belt-and-suspenders.
Copy file name to clipboardExpand all lines: docs/SETUP_ENGINE_REDESIGN.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,6 +80,8 @@ src/OpenClaw.SetupEngine.UI/
80
80
## Config File (`default-config.json`)
81
81
82
82
**Config is required.** Neither the headless exe nor the UI will run without one. The bundled `default-config.json` is auto-loaded from `AppContext.BaseDirectory` if no `--config` is specified.
83
+
If the setup UI cannot find, read, or deserialize the selected configuration,
84
+
it opens on the setup failure page with the load error and does not start setup.
Common flags include `--config`, `--headless`, `--dry-run`, `--rollback-on-failure`, `--no-rollback-on-failure`, `--log-path`, `--gateway-port`, and uninstall safety flags such as `--uninstall` plus `--confirm-destructive`.
321
323
324
+
SetupEngine option names are case-insensitive. Value options accept either separated
325
+
syntax (`--config custom.json`) or equals syntax (`--config=custom.json`). Unknown
326
+
options, bare `--`, and positional arguments are rejected with exit code 2.
327
+
Boolean flags do not accept values, and duplicate value options are rejected;
328
+
duplicate bare flags remain idempotent.
329
+
330
+
Duplicate value rejection is an intentional compatibility break from the legacy
331
+
first-value-wins behavior. Scripts that repeat a value option must remove the
332
+
duplicate before upgrading.
333
+
334
+
The same parser enforces the tray-hosted setup window's narrower command-line
335
+
contract: `--config` and `--no-rollback-on-failure`. The tray projects recognized
336
+
restart and deep-link host arguments out first. A restart PID must be a positive
337
+
integer other than the current process, and the post-setup launch target must be
338
+
`chat`; malformed host values remain for strict rejection. All remaining unknown options,
339
+
positionals, missing values, and duplicates render the setup failure page before
340
+
the setup lock is acquired. The tray executable's uninstall arguments are parsed
341
+
by `CliUninstallHandler` and currently use separated syntax for values such as
342
+
`--json-output <path>`.
343
+
322
344
Exit codes: 0 = success, 1 = pipeline failure, 2 = bad arguments or setup lock/safety failure, 3 = cancelled
0 commit comments