Skip to content

feat: Additional support for bidirectional communication between the debugger and MC#365

Merged
anthonywongskyboxlabs merged 9 commits intomainfrom
sbl/bidirectional-comms
Apr 15, 2026
Merged

feat: Additional support for bidirectional communication between the debugger and MC#365
anthonywongskyboxlabs merged 9 commits intomainfrom
sbl/bidirectional-comms

Conversation

@anthonywongskyboxlabs
Copy link
Copy Markdown
Contributor

@anthonywongskyboxlabs anthonywongskyboxlabs commented Apr 8, 2026

Added support for sending requests that expect a response. Right now our main use cases for this are toggling on/off specific profilers.

The request flow:

  1. Button (or some other UI element in a tab) calls sendDebuggerRequest, which posts a message to the webview host
  2. handleDebuggerRequest is called, and further forwards the request to the debug session via await session.customRequest(...)
  3. The request makes its way to MC, see request-manager.ts

Request format:

{ 
  "type": "debugger-request", 
  "request": { 
    "request_seq": 17, 
    "request": "Start CPU Profiler", 
    "args": { "foo": "bar" } 
  } 
} 

Eventually a response is received, and we walk back up the pipe, sending the response args back to the tab that requested it.

Format of response message being sent back to the debugger:
image

Naming of requests and responses

Originally I just wanted to call these requests and responses to keep them simple. However, those two keywords are already used in our QuickJS repo (example), so I didn't want to confuse them with this work.

Comment thread webview-ui/src/diagnostics_panel/utilities/useDebuggerRequests.ts Outdated
Comment thread src/session.ts
Comment thread webview-ui/src/diagnostics_panel/utilities/useDebuggerRequests.ts Outdated
Copy link
Copy Markdown

@codyward-skybox codyward-skybox left a comment

Choose a reason for hiding this comment

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

Overall looks good to me, though it'd be nice to get eyes from someone with more experience in this part of the codebase.

@anthonywongskyboxlabs anthonywongskyboxlabs merged commit 22064e5 into main Apr 15, 2026
2 checks passed
@anthonywongskyboxlabs anthonywongskyboxlabs deleted the sbl/bidirectional-comms branch April 15, 2026 19:35
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.

3 participants