@babylonjs/node-render-graph-editor 9.3.0 → 9.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2733,7 +2733,6 @@ export interface IDisplayManager {
2733
2733
 
2734
2734
  }
2735
2735
  declare module "@babylonjs/node-render-graph-editor/modularTool/modularTool" {
2736
- import { IDisposable } from "@babylonjs/core/index";
2737
2736
  import { IExtensionFeed } from "@babylonjs/node-render-graph-editor/modularTool/extensibility/extensionFeed";
2738
2737
  import { WeaklyTypedServiceDefinition, ServiceContainer } from "@babylonjs/node-render-graph-editor/modularTool/modularity/serviceContainer";
2739
2738
  import { ShellServiceOptions } from "@babylonjs/node-render-graph-editor/modularTool/services/shellService";
@@ -2774,7 +2773,65 @@ export type ModularToolOptions = {
2774
2773
  * @param options The options for the tool.
2775
2774
  * @returns A token that can be used to dispose of the tool.
2776
2775
  */
2777
- export function MakeModularTool(options: ModularToolOptions): IDisposable;
2776
+ export function MakeModularTool(options: ModularToolOptions): {
2777
+ dispose: () => Promise<void>;
2778
+ };
2779
+
2780
+ }
2781
+ declare module "@babylonjs/node-render-graph-editor/modularTool/modularBridge" {
2782
+ import { IDisposable } from "@babylonjs/core/index";
2783
+ import { WeaklyTypedServiceDefinition, ServiceContainer } from "@babylonjs/node-render-graph-editor/modularTool/modularity/serviceContainer";
2784
+ /**
2785
+ * Options for creating a modular bridge container.
2786
+ * @experimental
2787
+ * @internal
2788
+ */
2789
+ export type ModularBridgeOptions = {
2790
+ /**
2791
+ * WebSocket port for the bridge's browser port. Defaults to 4400.
2792
+ */
2793
+ port?: number;
2794
+ /**
2795
+ * Session display name reported to the bridge. Defaults to `document.title`.
2796
+ */
2797
+ name?: string;
2798
+ /**
2799
+ * Whether the bridge should automatically start trying to connect.
2800
+ * Defaults to false.
2801
+ */
2802
+ autoStart?: boolean;
2803
+ /**
2804
+ * Additional service definitions to register with the bridge container.
2805
+ */
2806
+ serviceDefinitions?: readonly WeaklyTypedServiceDefinition[];
2807
+ };
2808
+ /**
2809
+ * A token returned by {@link MakeModularBridge} that owns the headless
2810
+ * {@link ServiceContainer}. Dispose it to tear down the bridge and all services.
2811
+ * @experimental
2812
+ * @internal
2813
+ */
2814
+ export type ModularBridgeToken = IDisposable & {
2815
+ /**
2816
+ * The headless ServiceContainer that hosts the bridge.
2817
+ */
2818
+ readonly serviceContainer: ServiceContainer;
2819
+ /**
2820
+ * Whether this token has been disposed.
2821
+ */
2822
+ readonly isDisposed: boolean;
2823
+ };
2824
+ /**
2825
+ * Creates a headless {@link ServiceContainer} that hosts a bridge service.
2826
+ *
2827
+ * The returned token owns the container. Dispose it to tear down the bridge.
2828
+ *
2829
+ * @param options Optional configuration for the bridge.
2830
+ * @returns A {@link ModularBridgeToken} that owns the container.
2831
+ * @experimental
2832
+ * @internal
2833
+ */
2834
+ export function MakeModularBridge(options?: ModularBridgeOptions): ModularBridgeToken;
2778
2835
 
2779
2836
  }
2780
2837
  declare module "@babylonjs/node-render-graph-editor/modularTool/themes/babylonTheme" {
@@ -3254,6 +3311,359 @@ import { ServiceDefinition } from "@babylonjs/node-render-graph-editor/modularTo
3254
3311
  import { IShellService } from "@babylonjs/node-render-graph-editor/modularTool/services/shellService";
3255
3312
  export const ExtensionListServiceDefinition: ServiceDefinition<[], [IShellService]>;
3256
3313
 
3314
+ }
3315
+ declare module "@babylonjs/node-render-graph-editor/modularTool/services/cli/protocol" {
3316
+ /**
3317
+ * Serializable description of a command argument, used in protocol messages.
3318
+ */
3319
+ export type CommandArgInfo = {
3320
+ /** The name of the argument. */
3321
+ name: string;
3322
+ /** A human-readable description of the argument. */
3323
+ description: string;
3324
+ /** Whether this argument is required. */
3325
+ required?: boolean;
3326
+ /** The type of the argument. Defaults to "string". When "file", the CLI reads the file and sends its contents. */
3327
+ type?: "string" | "file";
3328
+ };
3329
+ /**
3330
+ * Serializable description of a command, used in protocol messages.
3331
+ */
3332
+ export type CommandInfo = {
3333
+ /** A unique identifier for the command. */
3334
+ id: string;
3335
+ /** A human-readable description of the command. */
3336
+ description: string;
3337
+ /** The arguments this command accepts. */
3338
+ args?: CommandArgInfo[];
3339
+ };
3340
+ /**
3341
+ * Serializable description of a session, used in protocol messages.
3342
+ */
3343
+ export type SessionInfo = {
3344
+ /** The numeric session identifier. */
3345
+ id: number;
3346
+ /** The display name of the session. */
3347
+ name: string;
3348
+ /** ISO 8601 timestamp of when the session connected. */
3349
+ connectedAt: string;
3350
+ };
3351
+ /**
3352
+ * CLI → Bridge: Request the list of active browser sessions.
3353
+ */
3354
+ export type SessionsRequest = {
3355
+ /** The message type discriminator. */
3356
+ type: "sessions";
3357
+ };
3358
+ /**
3359
+ * CLI → Bridge: Request the list of commands available from a session.
3360
+ */
3361
+ export type CommandsRequest = {
3362
+ /** The message type discriminator. */
3363
+ type: "commands";
3364
+ /** The session to query for commands. */
3365
+ sessionId: number;
3366
+ };
3367
+ /**
3368
+ * CLI → Bridge: Execute a command on a session.
3369
+ */
3370
+ export type ExecRequest = {
3371
+ /** The message type discriminator. */
3372
+ type: "exec";
3373
+ /** The session to execute the command on. */
3374
+ sessionId: number;
3375
+ /** The identifier of the command to execute. */
3376
+ commandId: string;
3377
+ /** Key-value pairs of arguments for the command. */
3378
+ args: Record<string, string>;
3379
+ };
3380
+ /**
3381
+ * CLI → Bridge: Stop the bridge process.
3382
+ */
3383
+ export type StopRequest = {
3384
+ /** The message type discriminator. */
3385
+ type: "stop";
3386
+ };
3387
+ /**
3388
+ * All messages that the CLI sends to the bridge.
3389
+ */
3390
+ export type CliRequest = SessionsRequest | CommandsRequest | ExecRequest | StopRequest;
3391
+ /**
3392
+ * Bridge → CLI: Response with the list of active sessions.
3393
+ */
3394
+ export type SessionsResponse = {
3395
+ /** The message type discriminator. */
3396
+ type: "sessionsResponse";
3397
+ /** The list of active sessions. */
3398
+ sessions: SessionInfo[];
3399
+ };
3400
+ /**
3401
+ * Bridge → CLI: Response with the list of commands from a session.
3402
+ */
3403
+ export type CommandsResponse = {
3404
+ /** The message type discriminator. */
3405
+ type: "commandsResponse";
3406
+ /** The list of available commands, if successful. */
3407
+ commands?: CommandInfo[];
3408
+ /** An error message, if the request failed. */
3409
+ error?: string;
3410
+ };
3411
+ /**
3412
+ * Bridge → CLI: Response with the result of a command execution.
3413
+ */
3414
+ export type ExecResponse = {
3415
+ /** The message type discriminator. */
3416
+ type: "execResponse";
3417
+ /** The result of the command execution, if successful. */
3418
+ result?: string;
3419
+ /** An error message, if the execution failed. */
3420
+ error?: string;
3421
+ };
3422
+ /**
3423
+ * Bridge → CLI: Acknowledgement that the bridge is stopping.
3424
+ */
3425
+ export type StopResponse = {
3426
+ /** The message type discriminator. */
3427
+ type: "stopResponse";
3428
+ /** Whether the bridge stopped successfully. */
3429
+ success: boolean;
3430
+ };
3431
+ /**
3432
+ * All messages that the bridge sends to the CLI.
3433
+ */
3434
+ export type CliResponse = SessionsResponse | CommandsResponse | ExecResponse | StopResponse;
3435
+ /**
3436
+ * Browser → Bridge: Register a new session.
3437
+ */
3438
+ export type RegisterRequest = {
3439
+ /** The message type discriminator. */
3440
+ type: "register";
3441
+ /** The display name for this session. */
3442
+ name: string;
3443
+ };
3444
+ /**
3445
+ * Browser → Bridge: Response to a listCommands request from the bridge.
3446
+ */
3447
+ export type CommandListResponse = {
3448
+ /** The message type discriminator. */
3449
+ type: "commandListResponse";
3450
+ /** The identifier of the original request. */
3451
+ requestId: string;
3452
+ /** The list of registered commands. */
3453
+ commands: CommandInfo[];
3454
+ };
3455
+ /**
3456
+ * Browser → Bridge: Response to an execCommand request from the bridge.
3457
+ */
3458
+ export type CommandResponse = {
3459
+ /** The message type discriminator. */
3460
+ type: "commandResponse";
3461
+ /** The identifier of the original request. */
3462
+ requestId: string;
3463
+ /** The result of the command execution, if successful. */
3464
+ result?: string;
3465
+ /** An error message, if the execution failed. */
3466
+ error?: string;
3467
+ };
3468
+ /**
3469
+ * Browser → Bridge: Response to a getInfo request from the bridge.
3470
+ */
3471
+ export type InfoResponse = {
3472
+ /** The message type discriminator. */
3473
+ type: "infoResponse";
3474
+ /** The identifier of the original request. */
3475
+ requestId: string;
3476
+ /** The current display name of the session. */
3477
+ name: string;
3478
+ };
3479
+ /**
3480
+ * All messages that the browser sends to the bridge.
3481
+ */
3482
+ export type BrowserRequest = RegisterRequest | CommandListResponse | CommandResponse | InfoResponse;
3483
+ /**
3484
+ * Bridge → Browser: Request the list of registered commands.
3485
+ */
3486
+ export type ListCommandsRequest = {
3487
+ /** The message type discriminator. */
3488
+ type: "listCommands";
3489
+ /** A unique identifier for this request. */
3490
+ requestId: string;
3491
+ };
3492
+ /**
3493
+ * Bridge → Browser: Request execution of a command.
3494
+ */
3495
+ export type ExecCommandRequest = {
3496
+ /** The message type discriminator. */
3497
+ type: "execCommand";
3498
+ /** A unique identifier for this request. */
3499
+ requestId: string;
3500
+ /** The identifier of the command to execute. */
3501
+ commandId: string;
3502
+ /** Key-value pairs of arguments for the command. */
3503
+ args: Record<string, string>;
3504
+ };
3505
+ /**
3506
+ * Bridge → Browser: Request current session information.
3507
+ */
3508
+ export type GetInfoRequest = {
3509
+ /** The message type discriminator. */
3510
+ type: "getInfo";
3511
+ /** A unique identifier for this request. */
3512
+ requestId: string;
3513
+ };
3514
+ /**
3515
+ * All messages that the bridge sends to the browser.
3516
+ */
3517
+ export type BrowserResponse = ListCommandsRequest | ExecCommandRequest | GetInfoRequest;
3518
+
3519
+ }
3520
+ declare module "@babylonjs/node-render-graph-editor/modularTool/services/cli/bridgeService" {
3521
+ import { ServiceDefinition } from "@babylonjs/node-render-graph-editor/modularTool/modularity/serviceDefinition";
3522
+ import { ICliConnectionStatus } from "@babylonjs/node-render-graph-editor/modularTool/services/cli/bridgeConnectionStatus";
3523
+ import { IBridgeCommandRegistry } from "@babylonjs/node-render-graph-editor/modularTool/services/cli/bridgeCommandRegistry";
3524
+ /**
3525
+ * Options for the CLI bridge service.
3526
+ * @experimental
3527
+ * @internal
3528
+ */
3529
+ export type BridgeServiceOptions = {
3530
+ /**
3531
+ * The WebSocket port for the bridge's browser port.
3532
+ */
3533
+ port: number;
3534
+ /**
3535
+ * The session display name sent to the bridge.
3536
+ * Can be a getter to provide a dynamic value that is re-read
3537
+ * each time the bridge queries session information.
3538
+ */
3539
+ name: string;
3540
+ /**
3541
+ * Whether to automatically start connecting when the service is created.
3542
+ */
3543
+ autoStart: boolean;
3544
+ };
3545
+ /**
3546
+ * Creates the service definition for the CLI Bridge Service.
3547
+ * @param options The options for connecting to the bridge.
3548
+ * @returns A service definition that produces an IBridgeCommandRegistry and ICliConnectionStatus.
3549
+ * @experimental
3550
+ * @internal
3551
+ */
3552
+ export function MakeBridgeServiceDefinition(options: BridgeServiceOptions): ServiceDefinition<[IBridgeCommandRegistry, ICliConnectionStatus], []>;
3553
+
3554
+ }
3555
+ declare module "@babylonjs/node-render-graph-editor/modularTool/services/cli/bridgeConnectionStatus" {
3556
+ import { IReadonlyObservable } from "@babylonjs/core/index";
3557
+ import { IService } from "@babylonjs/node-render-graph-editor/modularTool/modularity/serviceDefinition";
3558
+ /**
3559
+ * The service identity for the CLI connection status.
3560
+ * @experimental
3561
+ * @internal
3562
+ */
3563
+ export const CliConnectionStatusIdentity: unique symbol;
3564
+ /**
3565
+ * Provides the connection status and enable/disable control for the CLI bridge.
3566
+ * @experimental
3567
+ * @internal
3568
+ */
3569
+ export interface ICliConnectionStatus extends IService<typeof CliConnectionStatusIdentity> {
3570
+ /**
3571
+ * Whether the bridge is enabled. When true, the bridge actively tries to
3572
+ * maintain a WebSocket connection. When false, the bridge is disconnected
3573
+ * and idle.
3574
+ */
3575
+ isEnabled: boolean;
3576
+ /**
3577
+ * Whether the bridge WebSocket is currently connected.
3578
+ */
3579
+ readonly isConnected: boolean;
3580
+ /**
3581
+ * Observable that fires when either {@link isEnabled} or {@link isConnected} changes.
3582
+ */
3583
+ readonly onConnectionStatusChanged: IReadonlyObservable<void>;
3584
+ }
3585
+
3586
+ }
3587
+ declare module "@babylonjs/node-render-graph-editor/modularTool/services/cli/bridgeCommandRegistry" {
3588
+ import { IDisposable } from "@babylonjs/core/index";
3589
+ import { IService } from "@babylonjs/node-render-graph-editor/modularTool/modularity/serviceDefinition";
3590
+ /**
3591
+ * The type of a bridge command argument, which determines how
3592
+ * the CLI processes the value before sending it to the browser.
3593
+ * @experimental
3594
+ * @internal
3595
+ */
3596
+ export type BridgeCommandArgType = "string" | "file";
3597
+ /**
3598
+ * Describes an argument for a bridge command.
3599
+ * @experimental
3600
+ * @internal
3601
+ */
3602
+ export type BridgeCommandArg = {
3603
+ /**
3604
+ * The name of the argument.
3605
+ */
3606
+ name: string;
3607
+ /**
3608
+ * A description of the argument.
3609
+ */
3610
+ description: string;
3611
+ /**
3612
+ * Whether the argument is required.
3613
+ */
3614
+ required?: boolean;
3615
+ /**
3616
+ * The type of the argument. Defaults to "string".
3617
+ * When set to "file", the CLI reads the file at the given path
3618
+ * and passes its contents as the argument value.
3619
+ */
3620
+ type?: BridgeCommandArgType;
3621
+ };
3622
+ /**
3623
+ * Describes a command that can be invoked from the bridge.
3624
+ * @experimental
3625
+ * @internal
3626
+ */
3627
+ export type BridgeCommandDescriptor = {
3628
+ /**
3629
+ * A unique identifier for the command.
3630
+ */
3631
+ id: string;
3632
+ /**
3633
+ * A human-readable description of what the command does.
3634
+ */
3635
+ description: string;
3636
+ /**
3637
+ * The arguments that this command accepts.
3638
+ */
3639
+ args?: BridgeCommandArg[];
3640
+ /**
3641
+ * Executes the command with the given arguments and returns a result string.
3642
+ * @param args A map of argument names to their values.
3643
+ * @returns A promise that resolves to the result string.
3644
+ */
3645
+ executeAsync: (args: Record<string, string>) => Promise<string>;
3646
+ };
3647
+ /**
3648
+ * The service identity for the bridge command registry.
3649
+ * @experimental
3650
+ * @internal
3651
+ */
3652
+ export const BridgeCommandRegistryIdentity: unique symbol;
3653
+ /**
3654
+ * A registry for commands that can be invoked from the bridge.
3655
+ * @experimental
3656
+ * @internal
3657
+ */
3658
+ export interface IBridgeCommandRegistry extends IService<typeof BridgeCommandRegistryIdentity> {
3659
+ /**
3660
+ * Registers a command that can be invoked from the bridge.
3661
+ * @param descriptor The command descriptor.
3662
+ * @returns A disposable token that unregisters the command when disposed.
3663
+ */
3664
+ addCommand(descriptor: BridgeCommandDescriptor): IDisposable;
3665
+ }
3666
+
3257
3667
  }
3258
3668
  declare module "@babylonjs/node-render-graph-editor/modularTool/modularity/serviceDefinition" {
3259
3669
  import { IDisposable } from "@babylonjs/core/index";
@@ -3278,14 +3688,13 @@ type ExtractContractIdentities<ServiceContracts extends IService<symbol>[]> = {
3278
3688
  [Index in keyof ServiceContracts]: ExtractContractIdentity<ServiceContracts[Index]>;
3279
3689
  };
3280
3690
  type UnionToIntersection<Union> = (Union extends any ? (k: Union) => void : never) extends (k: infer Intersection) => void ? Intersection : never;
3281
- type MaybePromise<T> = T | Promise<T>;
3282
3691
  /**
3283
3692
  * A factory function responsible for creating a service instance.
3284
3693
  * Consumed services are passed as arguments to the factory function.
3285
- * The returned value must implement all produced services, and may IDisposable.
3286
- * If not services are produced, the returned value may implement IDisposable, otherwise it may return void.
3694
+ * The returned value must implement all produced services, and may implement IDisposable.
3695
+ * If no services are produced, the returned value may implement IDisposable, otherwise it may return void.
3287
3696
  */
3288
- export type ServiceFactory<Produces extends IService<symbol>[], Consumes extends IService<symbol>[]> = (...dependencies: [...Consumes, abortSignal?: AbortSignal]) => MaybePromise<Produces extends [] ? Partial<IDisposable> | void : Partial<IDisposable> & UnionToIntersection<Produces[number]>>;
3697
+ export type ServiceFactory<Produces extends IService<symbol>[], Consumes extends IService<symbol>[]> = (...dependencies: [...Consumes]) => Produces extends [] ? Partial<IDisposable> | void : Partial<IDisposable> & UnionToIntersection<Produces[number]>;
3289
3698
  /**
3290
3699
  * Defines a service, which is a logical unit that consumes other services (dependencies), and optionally produces services that can be consumed by other services (dependents).
3291
3700
  */
@@ -3351,20 +3760,19 @@ export class ServiceContainer implements IDisposable {
3351
3760
  */
3352
3761
  constructor(_friendlyName: string, _parent?: ServiceContainer | undefined);
3353
3762
  /**
3354
- * Adds a set of service definitions in the service container.
3763
+ * Adds a set of service definitions to the service container.
3355
3764
  * The services are sorted based on their dependencies.
3356
- * @param args The service definitions to register, and optionally an abort signal.
3357
- * @returns A disposable that will remove the service definition from the service container.
3765
+ * @param serviceDefinitions The service definitions to register.
3766
+ * @returns A disposable that will remove the service definitions from the service container.
3358
3767
  */
3359
- addServicesAsync(...args: WeaklyTypedServiceDefinition[] | [...serviceDefinitions: WeaklyTypedServiceDefinition[], abortSignal: AbortSignal]): Promise<IDisposable>;
3768
+ addServices(...serviceDefinitions: WeaklyTypedServiceDefinition[]): IDisposable;
3360
3769
  /**
3361
3770
  * Registers a service definition in the service container.
3362
3771
  * @param serviceDefinition The service definition to register.
3363
- * @param abortSignal An optional abort signal.
3364
3772
  * @returns A disposable that will remove the service definition from the service container.
3365
3773
  */
3366
- addServiceAsync<Produces extends IService<symbol>[] = [], Consumes extends IService<symbol>[] = []>(serviceDefinition: ServiceDefinition<Produces, Consumes>, abortSignal?: AbortSignal): Promise<IDisposable>;
3367
- private _addServiceAsync;
3774
+ addService<Produces extends IService<symbol>[] = [], Consumes extends IService<symbol>[] = []>(serviceDefinition: ServiceDefinition<Produces, Consumes>): IDisposable;
3775
+ private _addService;
3368
3776
  /**
3369
3777
  * Resolves a dependency by contract identity for a consuming service.
3370
3778
  * Checks local services first, then walks up the parent chain.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonjs/node-render-graph-editor",
3
- "version": "9.3.0",
3
+ "version": "9.3.1",
4
4
  "main": "dist/babylon.nodeRenderGraphEditor.js",
5
5
  "module": "dist/babylon.nodeRenderGraphEditor.js",
6
6
  "esnext": "dist/babylon.nodeRenderGraphEditor.js",
@@ -23,7 +23,7 @@
23
23
  "@types/react-dom": ">=16.0.9"
24
24
  },
25
25
  "devDependencies": {
26
- "@babylonjs/core": "9.3.0",
26
+ "@babylonjs/core": "9.3.1",
27
27
  "@tools/node-render-graph-editor": "1.0.0",
28
28
  "react": "^18.2.0",
29
29
  "react-dom": "^18.2.0"