Skip to content

[codex] promote DesktopManager automation core and thin wrappers#164

Merged
PrzemyslawKlys merged 7 commits intov2-speedygonzalesfrom
feature/autoit-equivalence-audit
Mar 31, 2026
Merged

[codex] promote DesktopManager automation core and thin wrappers#164
PrzemyslawKlys merged 7 commits intov2-speedygonzalesfrom
feature/autoit-equivalence-audit

Conversation

@PrzemyslawKlys
Copy link
Copy Markdown
Member

What changed

  • moved more desktop-management behavior into DesktopAutomationService as the canonical C# automation core
  • added first-class observation, wait, mouse, control-state, screenshot, process, clipboard, personalization, and monitor-management helpers
  • exposed thin PowerShell and MCP/CLI wrappers over the new core capabilities
  • tightened PowerShell cmdlets so they mostly bind parameters and delegate to the core service
  • added focused regression coverage for the new core and wrapper surfaces

Why

DesktopManager is increasingly being used as the foundation for MCP, plugins, PowerShell, and EasyControlX. This change moves the real desktop automation behavior into the C# core so the wrapper layers stay thin and consistent.

Impact

  • PowerShell desktop-management cmdlets no longer reach directly into WindowManager or Monitors
  • new core APIs are available for future MCP/CLI/plugin use without re-implementing behavior in wrappers
  • the monitor/personalization and window/control automation surfaces are more consistent across consumers

Validation

  • dotnet test Sources/DesktopManager.Tests/DesktopManager.Tests.csproj -c Debug -f net8.0-windows --filter "DesktopAutomationCoreTests|PowerShellCoreCmdletSurfaceTests|PowerShellControlMutationTests"
  • dotnet test Sources/DesktopManager.Tests/DesktopManager.Tests.csproj -c Debug -f net8.0-windows
  • downstream build against EasyControlX wrapper branch

@PrzemyslawKlys PrzemyslawKlys marked this pull request as ready for review March 31, 2026 09:38
@PrzemyslawKlys PrzemyslawKlys merged commit 2eaaadf into v2-speedygonzales Mar 31, 2026
5 checks passed
@PrzemyslawKlys PrzemyslawKlys deleted the feature/autoit-equivalence-audit branch March 31, 2026 09:38
@github-actions github-actions bot restored the feature/autoit-equivalence-audit branch March 31, 2026 09:39
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6945df6bd5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +69 to +70
if (uint.TryParse(trimmed, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out uint hexValue)) {
return hexValue;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Parse decimal colors before hex fallback

ParseRequiredColor currently tries hexadecimal parsing for every input, so plain decimal values like "255" are interpreted as hex (0x255 => 597) instead of decimal. This breaks the documented decimal|0xRRGGBB|#RRGGBB behavior for set-background-color/set_desktop_background_color and yields incorrect colors whenever users pass decimal strings without a prefix.

Useful? React with 👍 / 👎.

@@ -107,7 +523,7 @@ public bool ActiveWindowMatches(WindowQueryOptions options) {
}

WindowInfo window = ResolveWindows(options, all: false)[0];
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Return null when focused-control window is absent

GetFocusedControlObservation is nullable by contract, but this direct indexing path throws when no window currently matches the selector. In practice, wait workflows that poll for focused controls will fail immediately on the first miss instead of waiting for a matching window/control to appear.

Useful? React with 👍 / 👎.

DesktopTextObservationOptions settings = observationOptions ?? new DesktopTextObservationOptions();
ValidateTextObservationOptions(settings);

WindowInfo window = ResolveSingleWindow(options);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Let text observation return null when no window matches

ObserveWindowText advertises a nullable result, but this call path throws if no window is currently present. That causes wait_for_observed_text polling to terminate early with an exception whenever the target window appears later, instead of continuing until timeout or success.

Useful? React with 👍 / 👎.

Comment on lines +1309 to +1311
"stop_window_keep_alive" => ReadBool(arguments, "allSessions")
? DesktopOperations.StopAllWindowKeepAlive()
: DesktopOperations.StopWindowKeepAlive(ReadWindowCriteria(arguments, true)),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject allSessions mixed with selectors in MCP keep-alive stop

When allSessions is true, MCP unconditionally calls StopAllWindowKeepAlive() and ignores any provided selectors. If a caller sends both (for example via generic argument builders), it can unintentionally stop keep-alive sessions for unrelated apps; CLI already guards against this combination, so MCP should apply the same validation.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant