[Web runtime] Add action capability dispatch to the Web Runtime - #1585
Open
minggangw wants to merge 1 commit into
Open
[Web runtime] Add action capability dispatch to the Web Runtime#1585minggangw wants to merge 1 commit into
minggangw wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new HTTP SSE action stream pump has an unhandled-rejection risk (errors can throw before the try/catch), which should be fixed to avoid potential crashes.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds ROS 2 action capability dispatch support to the rclnodejs Web Runtime, enabling clients using rclnodejs/web to send action goals and receive feedback/results over WebSocket, and over HTTP via SSE (with HTTP cancel explicitly unsupported).
Changes:
- Extend runtime capability registry/types to include
actionand routekind: 'action'frames in the dispatcher. - Implement WebSocket and HTTP(SSE) action goal execution flows, including feedback/result streaming and goal cancellation (WebSocket only).
- Add integration + protocol-level tests covering WebSocket and HTTP action behavior, plus update existing runtime tests for the new action handling.
File summaries
| File | Description |
|---|---|
| web/index.d.ts | Adds action-related SDK typings (ActionName, wire types, ActionHandle, RosClient.action overloads). |
| web/client.js | Implements SDK-side action goal dispatch over WS and HTTP(SSE), feedback routing, and cancellation (WS-only). |
| lib/runtime/capability_registry.js | Adds action capability kind storage, exposure, resolution, and listing. |
| lib/runtime/index.d.ts | Extends runtime types to include action capability kind and action frame fields (op, goalId). |
| lib/runtime/dispatcher.js | Implements action goal send/cancel handling and feedback/result emission on the wire. |
| lib/runtime/transports/http.js | Adds SSE-based HTTP action transport (HttpActionConnection) and enables action over HTTP. |
| test/test-web-action.js | New end-to-end tests for action wire protocol and SDK over WS and HTTP(SSE). |
| test/test-runtime.js | Updates/extends runtime tests to cover action registry and wire behavior changes. |
Review details
- Files reviewed: 6/8 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+589
to
+593
| const reader = body.getReader(); | ||
| const decoder = new TextDecoder(); | ||
| let buffer = ''; | ||
| try { | ||
| for (;;) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
--actionsupport to therclnodejs-webCLI and runtime declarations.Fix: #1579