Skip to content

Add MXC Sandbox example to Windows Node - #298

Closed
MythiliMur wants to merge 1 commit into
openclaw:masterfrom
MythiliMur:Add-MXC
Closed

MythiliMur wants to merge 1 commit into
openclaw:masterfrom
MythiliMur:Add-MXC

Conversation

@MythiliMur

Copy link
Copy Markdown

Add MXC sandbox example debug action and readable output

Add MXC sandbox example debug action and readable output
@github-actions github-actions Bot mentioned this pull request May 9, 2026
23 tasks
@github-actions github-actions Bot added documentation Improvements or additions to documentation enhancement New feature or request labels May 10, 2026
@shanselman
shanselman requested a review from Copilot May 10, 2026 20:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds an MXC SDK “simple sandbox” example to this repo and wires it into the Tray app’s Debug page so developers can run it and view a more readable result payload.

Changes:

  • Add a Node-based MXC sandbox example script that prints a JSON payload with sandbox stdout/stderr.
  • Add a DebugPage action that locates Node + the script, executes it with a timeout, and renders parsed/sanitized output in a dialog.
  • Introduce npm dependency metadata (package.json / package-lock.json) for @microsoft/mxc-sdk.
Show a summary per file
File Description
tools/mxc/simple-sandbox-example.cjs New Node script that runs a sandboxed command via MXC and prints a JSON payload.
src/OpenClaw.Tray.WinUI/Pages/DebugPage.xaml.cs Adds MXC invoke action, process execution helper, payload parsing, and dialog rendering.
src/OpenClaw.Tray.WinUI/Pages/DebugPage.xaml Adds a button to run the MXC sandbox example from the Debug Actions section.
package.json Adds npm dependency on @microsoft/mxc-sdk.
package-lock.json Locks @microsoft/mxc-sdk and transitive dependencies.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 4/5 changed files
  • Comments generated: 5

Comment on lines +363 to +373
using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
cts.CancelAfter(TimeSpan.FromMilliseconds(timeoutMs));

using var process = new Process { StartInfo = psi };
process.Start();

var stdoutTask = process.StandardOutput.ReadToEndAsync(cts.Token);
var stderrTask = process.StandardError.ReadToEndAsync(cts.Token);

await process.WaitForExitAsync(cts.Token);

Comment on lines +395 to +406
Environment.CurrentDirectory,
AppContext.BaseDirectory,
Path.GetDirectoryName(typeof(DebugPage).Assembly.Location) ?? string.Empty,
};

foreach (var root in probeRoots)
{
if (string.IsNullOrWhiteSpace(root))
{
continue;
}

Comment on lines +114 to +115
<Button Content="🧪 Run MXC Sandbox Example" Click="OnInvokeNodeCapabilityViaMxc"
HorizontalAlignment="Stretch"/>
};

process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
process.exit(result.exitCode === 0 ? 0 : 1);
Comment thread package.json
@@ -0,0 +1,5 @@
{
"dependencies": {
@shanselman

Copy link
Copy Markdown
Collaborator

Thanks for putting this MXC example together. Since this PR was opened, #319 has landed a production MXC/AppContainer implementation for system.run, including the package setup, bridge packaging, Sandbox settings page, availability checks, policy construction, and tests.

I don't think this PR should be merged as-is now because:

Closing as superseded by #319. If we still want a sample, the better follow-up would be a small docs/dev-only example that calls the production system.run sandbox path rather than adding a separate Debug page runner.

@shanselman

Copy link
Copy Markdown
Collaborator

Closing as superseded by #319's production MXC sandbox implementation.

@shanselman shanselman closed this May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants