Skip to content

Refine nexus bridge typing#45

Closed
air17 wants to merge 1 commit into
ForkHorizon:developmentfrom
air17:codex/nexus-bridge-typing
Closed

Refine nexus bridge typing#45
air17 wants to merge 1 commit into
ForkHorizon:developmentfrom
air17:codex/nexus-bridge-typing

Conversation

@air17

@air17 air17 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces type safety and improved code clarity to the NexusUnity Python bridge by defining and using explicit TypedDict-based types for JSON-RPC communication. The changes include the addition of a new _types.py module containing all relevant type definitions, and a comprehensive refactor of the bridge's core modules to utilize these types. This results in safer, more readable code and easier maintenance.

Copilot AI review requested due to automatic review settings June 12, 2026 17:55

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

Note

Copilot was unable to run its full agentic suite in this review.

This PR tightens type-safety across the NexusUnity Python bridge by introducing shared TypedDict/alias definitions and refactoring routing/transport helpers to use them consistently.

Changes:

  • Added a private _types.py module with JSON-RPC and payload type definitions.
  • Updated schemas/constants to use typed definitions (ToolDefinition, ResourceDefinition, JsonObject).
  • Refactored routing and transport to return/consume typed JSON-RPC responses and centralized result/error extraction.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
Editor/nexus_bridge/schemas.py Switches schema/tool/resource constants to shared typed definitions.
Editor/nexus_bridge/routing.py Refactors routing helpers to typed JSON-RPC shapes; adds helper accessors for result/error payloads.
Editor/nexus_bridge/_types.py Introduces shared TypeAlias/TypedDict definitions for bridge payloads.
Editor/nexus_bridge/_transport.py Updates call_unity to use the new JSON-RPC request/response types.

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

Comment on lines +188 to 191
STATIC_RESOURCES: list[ResourceDefinition] = [
{
"uri": "unity://docs/api-reference",
"name": "API Reference",
Comment on lines +78 to 81
def _apply_created_transform(response: JsonRpcResponse, args: JsonObject) -> JsonRpcResponse:
instance_id = _extract_created_instance_id(response)
if not instance_id:
return response
@air17 air17 closed this Jun 12, 2026
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.

2 participants