Inspector: Move CLI bridge infrastructure to shared ModularTool framework#18332
Inspector: Move CLI bridge infrastructure to shared ModularTool framework#18332ryantrem wants to merge 8 commits intoBabylonJS:masterfrom
Conversation
|
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
|
Building or testing the playground has failed. If the tests failed, results can be found here: |
|
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/18332/merge/index.html#WGZLGJ#4600 Links to test your changes to core in the published versions of the Babylon tools (does not contain changes you made to the tools themselves): https://playground.babylonjs.com/?snapshot=refs/pull/18332/merge To test the snapshot in the playground with a playground ID add it after the snapshot query string: https://playground.babylonjs.com/?snapshot=refs/pull/18332/merge#BCU1XR#0 If you made changes to the sandbox or playground in this PR, additional comments will be generated soon containing links to the dev versions of those tools. |
|
You have changed file(s) that made possible changes to the sandbox. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/18332/merge/ |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Self code review completed. Review fix: 47f50a82d3 — added \�oid\ operator to handle \Promise\ return from \disposeToken.dispose()\ in legacy inspector. |
|
Building or testing the playground has failed. If the tests failed, results can be found here: |
There was a problem hiding this comment.
Pull request overview
Extracts the Inspector v2 CLI bridge infrastructure into the shared sharedUiComponents ModularTool framework so CLI connectivity (bridge, command registry, connection status, protocol) can be reused by multiple modular tools (including Playground).
Changes:
- Introduces shared CLI bridge services/protocol under
sharedUiComponents/src/modularTool/services/cli/and adds a new sharedMakeModularBridgeentry point. - Refactors
ServiceContainer/ServiceDefinitionto a synchronous registration model and updates ModularTool + Inspector/Inspectable flows accordingly. - Updates Playground + Inspector v2 CLI/tests to consume the shared bridge APIs and adds additional bridge session robustness tests.
Reviewed changes
Copilot reviewed 28 out of 29 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/tools/playground/src/tools/playgroundCommandService.ts | Switches Playground CLI command registration to the shared bridge command registry. |
| packages/tools/playground/src/components/rendererComponent.tsx | Adds long-lived modular bridge token usage and wires inspectable sessions to reuse it. |
| packages/public/@babylonjs/inspector-v2/tsconfig.cli.json | Adds path mapping so Inspector v2 CLI can import shared bridge protocol/types. |
| packages/dev/sharedUiComponents/test/unit/modularity/serviceContainer.test.ts | Updates service container tests for the new synchronous API and adds cross-container dependency tests. |
| packages/dev/sharedUiComponents/test/unit/modularity/bridgeService.test.ts | Updates bridge service tests to new shared service identities/names. |
| packages/dev/sharedUiComponents/src/modularTool/services/cli/protocol.ts | Adds shared CLI↔bridge↔browser protocol types. |
| packages/dev/sharedUiComponents/src/modularTool/services/cli/bridgeService.ts | Moves/renames the browser-side bridge service to shared UI components. |
| packages/dev/sharedUiComponents/src/modularTool/services/cli/bridgeConnectionStatus.ts | Shared connection status contract/identity for CLI bridge. |
| packages/dev/sharedUiComponents/src/modularTool/services/cli/bridgeCommandRegistry.ts | Shared command registry contract/identity for CLI bridge commands. |
| packages/dev/sharedUiComponents/src/modularTool/modularity/serviceDefinition.ts | Updates service factory typing to the new synchronous model. |
| packages/dev/sharedUiComponents/src/modularTool/modularity/serviceContainer.ts | Implements synchronous addService(s) registration and parent resolution behavior. |
| packages/dev/sharedUiComponents/src/modularTool/modularTool.tsx | Updates ModularTool bootstrapping to use the synchronous service container and async disposal completion promise. |
| packages/dev/sharedUiComponents/src/modularTool/modularBridge.ts | New shared MakeModularBridge helper to create a headless bridge container/token. |
| packages/dev/sharedUiComponents/src/modularTool/extensibility/extensionManager.ts | Updates extension service registration to the synchronous service container API. |
| packages/dev/inspector-v2/test/unit/inspectable.test.ts | Updates inspectable tests for synchronous initialization behavior. |
| packages/dev/inspector-v2/test/unit/cli/cli.test.ts | Switches CLI tests to import the shared protocol types. |
| packages/dev/inspector-v2/test/unit/cli/bridge.test.ts | Adds coverage for info-timeout session eviction and re-registration behavior; imports shared protocol types. |
| packages/dev/inspector-v2/src/services/cliConnectionStatusService.tsx | Updates inspector UI service to consume shared bridge connection status identity/type. |
| packages/dev/inspector-v2/src/services/cli/*.ts | Migrates inspector CLI command services to use shared bridge command registry identity/type. |
| packages/dev/inspector-v2/src/legacy/inspector.tsx | Adjusts hide/disposal usage for async dispose tokens. |
| packages/dev/inspector-v2/src/inspector.tsx | Makes inspector token disposal async and ensures disposal order via observable insertion. |
| packages/dev/inspector-v2/src/inspectable.ts | Refactors inspectable to optionally reuse a long-lived modular bridge token; updates disposal ordering. |
| packages/dev/inspector-v2/src/index.ts | Re-exports shared bridge types + MakeModularBridge for consumers (e.g., Playground). |
| packages/dev/inspector-v2/src/cli/cli.ts | Switches CLI implementation to import shared protocol types. |
| packages/dev/inspector-v2/src/cli/bridge.ts | Adds configurable info-timeout and removes dead sessions / prevents session leaks on re-register. |
|
You have changed file(s) that made possible changes to the sandbox. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/18332/merge/ |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
WebGL2 visualization test reporter: |
|
Visualization tests for WebGPU |
|
You have changed file(s) that made possible changes to the sandbox. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/18332/merge/ |
|
You have made possible changes to the playground. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/18332/merge/ The snapshot playground with the CDN snapshot (only when available): Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly. |
|
Visualization tests for WebGPU |
|
WebGL2 visualization test reporter: |
|
You have changed file(s) that made possible changes to the sandbox. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/18332/merge/ |
|
You have made possible changes to the playground. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/18332/merge/ The snapshot playground with the CDN snapshot (only when available): Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly. |
|
Visualization tests for WebGPU |
|
WebGL2 visualization test reporter: |
Extracts the CLI bridge infrastructure from
inspector-v2into the sharedModularToolframework insharedUiComponents, making it reusable by any tool built withMakeModularTool.Key Design Point
The
MakeModularBridgeservice container is long-lived and survives across playground runs. Even though the scene is recreated on each run, the bridge stays the same and stays connected to the CLI. This ensures stable CLI connectivity without reconnection overhead.Changes
MakeModularBridge— a shared bridge entry point insharedUiComponents/src/modularTool/modularBridge.tsthat any modular tool can use for CLI connectivity.bridgeService,bridgeCommandRegistry,bridgeConnectionStatus, andprotocolnow live undersharedUiComponents/src/modularTool/services/cli/.serviceContainerandserviceDefinition— updated service container and definition types to support the generalized bridge pattern.