babylonjs-node-editor 9.3.0 → 9.3.2

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.
@@ -3177,7 +3177,6 @@ export interface IDisplayManager {
3177
3177
 
3178
3178
  }
3179
3179
  declare module "babylonjs-node-editor/modularTool/modularTool" {
3180
- import { IDisposable } from "babylonjs/index";
3181
3180
  import { IExtensionFeed } from "babylonjs-node-editor/modularTool/extensibility/extensionFeed";
3182
3181
  import { WeaklyTypedServiceDefinition, ServiceContainer } from "babylonjs-node-editor/modularTool/modularity/serviceContainer";
3183
3182
  import { ShellServiceOptions } from "babylonjs-node-editor/modularTool/services/shellService";
@@ -3218,7 +3217,65 @@ export type ModularToolOptions = {
3218
3217
  * @param options The options for the tool.
3219
3218
  * @returns A token that can be used to dispose of the tool.
3220
3219
  */
3221
- export function MakeModularTool(options: ModularToolOptions): IDisposable;
3220
+ export function MakeModularTool(options: ModularToolOptions): {
3221
+ dispose: () => Promise<void>;
3222
+ };
3223
+
3224
+ }
3225
+ declare module "babylonjs-node-editor/modularTool/modularBridge" {
3226
+ import { IDisposable } from "babylonjs/index";
3227
+ import { WeaklyTypedServiceDefinition, ServiceContainer } from "babylonjs-node-editor/modularTool/modularity/serviceContainer";
3228
+ /**
3229
+ * Options for creating a modular bridge container.
3230
+ * @experimental
3231
+ * @internal
3232
+ */
3233
+ export type ModularBridgeOptions = {
3234
+ /**
3235
+ * WebSocket port for the bridge's browser port. Defaults to 4400.
3236
+ */
3237
+ port?: number;
3238
+ /**
3239
+ * Session display name reported to the bridge. Defaults to `document.title`.
3240
+ */
3241
+ name?: string;
3242
+ /**
3243
+ * Whether the bridge should automatically enable trying to connect.
3244
+ * Defaults to true.
3245
+ */
3246
+ autoEnable?: boolean;
3247
+ /**
3248
+ * Additional service definitions to register with the bridge container.
3249
+ */
3250
+ serviceDefinitions?: readonly WeaklyTypedServiceDefinition[];
3251
+ };
3252
+ /**
3253
+ * A token returned by {@link MakeModularBridge} that owns the headless
3254
+ * {@link ServiceContainer}. Dispose it to tear down the bridge and all services.
3255
+ * @experimental
3256
+ * @internal
3257
+ */
3258
+ export type ModularBridgeToken = IDisposable & {
3259
+ /**
3260
+ * The headless ServiceContainer that hosts the bridge.
3261
+ */
3262
+ readonly serviceContainer: ServiceContainer;
3263
+ /**
3264
+ * Whether this token has been disposed.
3265
+ */
3266
+ readonly isDisposed: boolean;
3267
+ };
3268
+ /**
3269
+ * Creates a headless {@link ServiceContainer} that hosts a bridge service.
3270
+ *
3271
+ * The returned token owns the container. Dispose it to tear down the bridge.
3272
+ *
3273
+ * @param options Optional configuration for the bridge.
3274
+ * @returns A {@link ModularBridgeToken} that owns the container.
3275
+ * @experimental
3276
+ * @internal
3277
+ */
3278
+ export function MakeModularBridge(options?: ModularBridgeOptions): ModularBridgeToken;
3222
3279
 
3223
3280
  }
3224
3281
  declare module "babylonjs-node-editor/modularTool/themes/babylonTheme" {
@@ -3698,6 +3755,359 @@ import { ServiceDefinition } from "babylonjs-node-editor/modularTool/modularity/
3698
3755
  import { IShellService } from "babylonjs-node-editor/modularTool/services/shellService";
3699
3756
  export const ExtensionListServiceDefinition: ServiceDefinition<[], [IShellService]>;
3700
3757
 
3758
+ }
3759
+ declare module "babylonjs-node-editor/modularTool/services/cli/protocol" {
3760
+ /**
3761
+ * Serializable description of a command argument, used in protocol messages.
3762
+ */
3763
+ export type CommandArgInfo = {
3764
+ /** The name of the argument. */
3765
+ name: string;
3766
+ /** A human-readable description of the argument. */
3767
+ description: string;
3768
+ /** Whether this argument is required. */
3769
+ required?: boolean;
3770
+ /** The type of the argument. Defaults to "string". When "file", the CLI reads the file and sends its contents. */
3771
+ type?: "string" | "file";
3772
+ };
3773
+ /**
3774
+ * Serializable description of a command, used in protocol messages.
3775
+ */
3776
+ export type CommandInfo = {
3777
+ /** A unique identifier for the command. */
3778
+ id: string;
3779
+ /** A human-readable description of the command. */
3780
+ description: string;
3781
+ /** The arguments this command accepts. */
3782
+ args?: CommandArgInfo[];
3783
+ };
3784
+ /**
3785
+ * Serializable description of a session, used in protocol messages.
3786
+ */
3787
+ export type SessionInfo = {
3788
+ /** The numeric session identifier. */
3789
+ id: number;
3790
+ /** The display name of the session. */
3791
+ name: string;
3792
+ /** ISO 8601 timestamp of when the session connected. */
3793
+ connectedAt: string;
3794
+ };
3795
+ /**
3796
+ * CLI → Bridge: Request the list of active browser sessions.
3797
+ */
3798
+ export type SessionsRequest = {
3799
+ /** The message type discriminator. */
3800
+ type: "sessions";
3801
+ };
3802
+ /**
3803
+ * CLI → Bridge: Request the list of commands available from a session.
3804
+ */
3805
+ export type CommandsRequest = {
3806
+ /** The message type discriminator. */
3807
+ type: "commands";
3808
+ /** The session to query for commands. */
3809
+ sessionId: number;
3810
+ };
3811
+ /**
3812
+ * CLI → Bridge: Execute a command on a session.
3813
+ */
3814
+ export type ExecRequest = {
3815
+ /** The message type discriminator. */
3816
+ type: "exec";
3817
+ /** The session to execute the command on. */
3818
+ sessionId: number;
3819
+ /** The identifier of the command to execute. */
3820
+ commandId: string;
3821
+ /** Key-value pairs of arguments for the command. */
3822
+ args: Record<string, string>;
3823
+ };
3824
+ /**
3825
+ * CLI → Bridge: Stop the bridge process.
3826
+ */
3827
+ export type StopRequest = {
3828
+ /** The message type discriminator. */
3829
+ type: "stop";
3830
+ };
3831
+ /**
3832
+ * All messages that the CLI sends to the bridge.
3833
+ */
3834
+ export type CliRequest = SessionsRequest | CommandsRequest | ExecRequest | StopRequest;
3835
+ /**
3836
+ * Bridge → CLI: Response with the list of active sessions.
3837
+ */
3838
+ export type SessionsResponse = {
3839
+ /** The message type discriminator. */
3840
+ type: "sessionsResponse";
3841
+ /** The list of active sessions. */
3842
+ sessions: SessionInfo[];
3843
+ };
3844
+ /**
3845
+ * Bridge → CLI: Response with the list of commands from a session.
3846
+ */
3847
+ export type CommandsResponse = {
3848
+ /** The message type discriminator. */
3849
+ type: "commandsResponse";
3850
+ /** The list of available commands, if successful. */
3851
+ commands?: CommandInfo[];
3852
+ /** An error message, if the request failed. */
3853
+ error?: string;
3854
+ };
3855
+ /**
3856
+ * Bridge → CLI: Response with the result of a command execution.
3857
+ */
3858
+ export type ExecResponse = {
3859
+ /** The message type discriminator. */
3860
+ type: "execResponse";
3861
+ /** The result of the command execution, if successful. */
3862
+ result?: string;
3863
+ /** An error message, if the execution failed. */
3864
+ error?: string;
3865
+ };
3866
+ /**
3867
+ * Bridge → CLI: Acknowledgement that the bridge is stopping.
3868
+ */
3869
+ export type StopResponse = {
3870
+ /** The message type discriminator. */
3871
+ type: "stopResponse";
3872
+ /** Whether the bridge stopped successfully. */
3873
+ success: boolean;
3874
+ };
3875
+ /**
3876
+ * All messages that the bridge sends to the CLI.
3877
+ */
3878
+ export type CliResponse = SessionsResponse | CommandsResponse | ExecResponse | StopResponse;
3879
+ /**
3880
+ * Browser → Bridge: Register a new session.
3881
+ */
3882
+ export type RegisterRequest = {
3883
+ /** The message type discriminator. */
3884
+ type: "register";
3885
+ /** The display name for this session. */
3886
+ name: string;
3887
+ };
3888
+ /**
3889
+ * Browser → Bridge: Response to a listCommands request from the bridge.
3890
+ */
3891
+ export type CommandListResponse = {
3892
+ /** The message type discriminator. */
3893
+ type: "commandListResponse";
3894
+ /** The identifier of the original request. */
3895
+ requestId: string;
3896
+ /** The list of registered commands. */
3897
+ commands: CommandInfo[];
3898
+ };
3899
+ /**
3900
+ * Browser → Bridge: Response to an execCommand request from the bridge.
3901
+ */
3902
+ export type CommandResponse = {
3903
+ /** The message type discriminator. */
3904
+ type: "commandResponse";
3905
+ /** The identifier of the original request. */
3906
+ requestId: string;
3907
+ /** The result of the command execution, if successful. */
3908
+ result?: string;
3909
+ /** An error message, if the execution failed. */
3910
+ error?: string;
3911
+ };
3912
+ /**
3913
+ * Browser → Bridge: Response to a getInfo request from the bridge.
3914
+ */
3915
+ export type InfoResponse = {
3916
+ /** The message type discriminator. */
3917
+ type: "infoResponse";
3918
+ /** The identifier of the original request. */
3919
+ requestId: string;
3920
+ /** The current display name of the session. */
3921
+ name: string;
3922
+ };
3923
+ /**
3924
+ * All messages that the browser sends to the bridge.
3925
+ */
3926
+ export type BrowserRequest = RegisterRequest | CommandListResponse | CommandResponse | InfoResponse;
3927
+ /**
3928
+ * Bridge → Browser: Request the list of registered commands.
3929
+ */
3930
+ export type ListCommandsRequest = {
3931
+ /** The message type discriminator. */
3932
+ type: "listCommands";
3933
+ /** A unique identifier for this request. */
3934
+ requestId: string;
3935
+ };
3936
+ /**
3937
+ * Bridge → Browser: Request execution of a command.
3938
+ */
3939
+ export type ExecCommandRequest = {
3940
+ /** The message type discriminator. */
3941
+ type: "execCommand";
3942
+ /** A unique identifier for this request. */
3943
+ requestId: string;
3944
+ /** The identifier of the command to execute. */
3945
+ commandId: string;
3946
+ /** Key-value pairs of arguments for the command. */
3947
+ args: Record<string, string>;
3948
+ };
3949
+ /**
3950
+ * Bridge → Browser: Request current session information.
3951
+ */
3952
+ export type GetInfoRequest = {
3953
+ /** The message type discriminator. */
3954
+ type: "getInfo";
3955
+ /** A unique identifier for this request. */
3956
+ requestId: string;
3957
+ };
3958
+ /**
3959
+ * All messages that the bridge sends to the browser.
3960
+ */
3961
+ export type BrowserResponse = ListCommandsRequest | ExecCommandRequest | GetInfoRequest;
3962
+
3963
+ }
3964
+ declare module "babylonjs-node-editor/modularTool/services/cli/bridgeService" {
3965
+ import { ServiceDefinition } from "babylonjs-node-editor/modularTool/modularity/serviceDefinition";
3966
+ import { ICliConnectionStatus } from "babylonjs-node-editor/modularTool/services/cli/bridgeConnectionStatus";
3967
+ import { IBridgeCommandRegistry } from "babylonjs-node-editor/modularTool/services/cli/bridgeCommandRegistry";
3968
+ /**
3969
+ * Options for the CLI bridge service.
3970
+ * @experimental
3971
+ * @internal
3972
+ */
3973
+ export type BridgeServiceOptions = {
3974
+ /**
3975
+ * The WebSocket port for the bridge's browser port.
3976
+ */
3977
+ port: number;
3978
+ /**
3979
+ * The session display name sent to the bridge.
3980
+ * Can be a getter to provide a dynamic value that is re-read
3981
+ * each time the bridge queries session information.
3982
+ */
3983
+ name: string;
3984
+ /**
3985
+ * Whether to automatically enable connecting when the service is created.
3986
+ */
3987
+ autoEnable: boolean;
3988
+ };
3989
+ /**
3990
+ * Creates the service definition for the CLI Bridge Service.
3991
+ * @param options The options for connecting to the bridge.
3992
+ * @returns A service definition that produces an IBridgeCommandRegistry and ICliConnectionStatus.
3993
+ * @experimental
3994
+ * @internal
3995
+ */
3996
+ export function MakeBridgeServiceDefinition(options: BridgeServiceOptions): ServiceDefinition<[IBridgeCommandRegistry, ICliConnectionStatus], []>;
3997
+
3998
+ }
3999
+ declare module "babylonjs-node-editor/modularTool/services/cli/bridgeConnectionStatus" {
4000
+ import { IReadonlyObservable } from "babylonjs/index";
4001
+ import { IService } from "babylonjs-node-editor/modularTool/modularity/serviceDefinition";
4002
+ /**
4003
+ * The service identity for the CLI connection status.
4004
+ * @experimental
4005
+ * @internal
4006
+ */
4007
+ export const CliConnectionStatusIdentity: unique symbol;
4008
+ /**
4009
+ * Provides the connection status and enable/disable control for the CLI bridge.
4010
+ * @experimental
4011
+ * @internal
4012
+ */
4013
+ export interface ICliConnectionStatus extends IService<typeof CliConnectionStatusIdentity> {
4014
+ /**
4015
+ * Whether the bridge is enabled. When true, the bridge actively tries to
4016
+ * maintain a WebSocket connection. When false, the bridge is disconnected
4017
+ * and idle.
4018
+ */
4019
+ isEnabled: boolean;
4020
+ /**
4021
+ * Whether the bridge WebSocket is currently connected.
4022
+ */
4023
+ readonly isConnected: boolean;
4024
+ /**
4025
+ * Observable that fires when either {@link isEnabled} or {@link isConnected} changes.
4026
+ */
4027
+ readonly onConnectionStatusChanged: IReadonlyObservable<void>;
4028
+ }
4029
+
4030
+ }
4031
+ declare module "babylonjs-node-editor/modularTool/services/cli/bridgeCommandRegistry" {
4032
+ import { IDisposable } from "babylonjs/index";
4033
+ import { IService } from "babylonjs-node-editor/modularTool/modularity/serviceDefinition";
4034
+ /**
4035
+ * The type of a bridge command argument, which determines how
4036
+ * the CLI processes the value before sending it to the browser.
4037
+ * @experimental
4038
+ * @internal
4039
+ */
4040
+ export type BridgeCommandArgType = "string" | "file";
4041
+ /**
4042
+ * Describes an argument for a bridge command.
4043
+ * @experimental
4044
+ * @internal
4045
+ */
4046
+ export type BridgeCommandArg = {
4047
+ /**
4048
+ * The name of the argument.
4049
+ */
4050
+ name: string;
4051
+ /**
4052
+ * A description of the argument.
4053
+ */
4054
+ description: string;
4055
+ /**
4056
+ * Whether the argument is required.
4057
+ */
4058
+ required?: boolean;
4059
+ /**
4060
+ * The type of the argument. Defaults to "string".
4061
+ * When set to "file", the CLI reads the file at the given path
4062
+ * and passes its contents as the argument value.
4063
+ */
4064
+ type?: BridgeCommandArgType;
4065
+ };
4066
+ /**
4067
+ * Describes a command that can be invoked from the bridge.
4068
+ * @experimental
4069
+ * @internal
4070
+ */
4071
+ export type BridgeCommandDescriptor = {
4072
+ /**
4073
+ * A unique identifier for the command.
4074
+ */
4075
+ id: string;
4076
+ /**
4077
+ * A human-readable description of what the command does.
4078
+ */
4079
+ description: string;
4080
+ /**
4081
+ * The arguments that this command accepts.
4082
+ */
4083
+ args?: BridgeCommandArg[];
4084
+ /**
4085
+ * Executes the command with the given arguments and returns a result string.
4086
+ * @param args A map of argument names to their values.
4087
+ * @returns A promise that resolves to the result string.
4088
+ */
4089
+ executeAsync: (args: Record<string, string>) => Promise<string>;
4090
+ };
4091
+ /**
4092
+ * The service identity for the bridge command registry.
4093
+ * @experimental
4094
+ * @internal
4095
+ */
4096
+ export const BridgeCommandRegistryIdentity: unique symbol;
4097
+ /**
4098
+ * A registry for commands that can be invoked from the bridge.
4099
+ * @experimental
4100
+ * @internal
4101
+ */
4102
+ export interface IBridgeCommandRegistry extends IService<typeof BridgeCommandRegistryIdentity> {
4103
+ /**
4104
+ * Registers a command that can be invoked from the bridge.
4105
+ * @param descriptor The command descriptor.
4106
+ * @returns A disposable token that unregisters the command when disposed.
4107
+ */
4108
+ addCommand(descriptor: BridgeCommandDescriptor): IDisposable;
4109
+ }
4110
+
3701
4111
  }
3702
4112
  declare module "babylonjs-node-editor/modularTool/modularity/serviceDefinition" {
3703
4113
  import { IDisposable } from "babylonjs/index";
@@ -3722,14 +4132,13 @@ type ExtractContractIdentities<ServiceContracts extends IService<symbol>[]> = {
3722
4132
  [Index in keyof ServiceContracts]: ExtractContractIdentity<ServiceContracts[Index]>;
3723
4133
  };
3724
4134
  type UnionToIntersection<Union> = (Union extends any ? (k: Union) => void : never) extends (k: infer Intersection) => void ? Intersection : never;
3725
- type MaybePromise<T> = T | Promise<T>;
3726
4135
  /**
3727
4136
  * A factory function responsible for creating a service instance.
3728
4137
  * Consumed services are passed as arguments to the factory function.
3729
- * The returned value must implement all produced services, and may IDisposable.
3730
- * If not services are produced, the returned value may implement IDisposable, otherwise it may return void.
4138
+ * The returned value must implement all produced services, and may implement IDisposable.
4139
+ * If no services are produced, the returned value may implement IDisposable, otherwise it may return void.
3731
4140
  */
3732
- 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]>>;
4141
+ export type ServiceFactory<Produces extends IService<symbol>[], Consumes extends IService<symbol>[]> = (...dependencies: [...Consumes]) => Produces extends [] ? Partial<IDisposable> | void : Partial<IDisposable> & UnionToIntersection<Produces[number]>;
3733
4142
  /**
3734
4143
  * 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).
3735
4144
  */
@@ -3795,20 +4204,19 @@ export class ServiceContainer implements IDisposable {
3795
4204
  */
3796
4205
  constructor(_friendlyName: string, _parent?: ServiceContainer | undefined);
3797
4206
  /**
3798
- * Adds a set of service definitions in the service container.
4207
+ * Adds a set of service definitions to the service container.
3799
4208
  * The services are sorted based on their dependencies.
3800
- * @param args The service definitions to register, and optionally an abort signal.
3801
- * @returns A disposable that will remove the service definition from the service container.
4209
+ * @param serviceDefinitions The service definitions to register.
4210
+ * @returns A disposable that will remove the service definitions from the service container.
3802
4211
  */
3803
- addServicesAsync(...args: WeaklyTypedServiceDefinition[] | [...serviceDefinitions: WeaklyTypedServiceDefinition[], abortSignal: AbortSignal]): Promise<IDisposable>;
4212
+ addServices(...serviceDefinitions: WeaklyTypedServiceDefinition[]): IDisposable;
3804
4213
  /**
3805
4214
  * Registers a service definition in the service container.
3806
4215
  * @param serviceDefinition The service definition to register.
3807
- * @param abortSignal An optional abort signal.
3808
4216
  * @returns A disposable that will remove the service definition from the service container.
3809
4217
  */
3810
- addServiceAsync<Produces extends IService<symbol>[] = [], Consumes extends IService<symbol>[] = []>(serviceDefinition: ServiceDefinition<Produces, Consumes>, abortSignal?: AbortSignal): Promise<IDisposable>;
3811
- private _addServiceAsync;
4218
+ addService<Produces extends IService<symbol>[] = [], Consumes extends IService<symbol>[] = []>(serviceDefinition: ServiceDefinition<Produces, Consumes>): IDisposable;
4219
+ private _addService;
3812
4220
  /**
3813
4221
  * Resolves a dependency by contract identity for a consuming service.
3814
4222
  * Checks local services first, then walks up the parent chain.
@@ -11272,7 +11680,69 @@ declare namespace BABYLON.NodeEditor.SharedUIComponents {
11272
11680
  * @param options The options for the tool.
11273
11681
  * @returns A token that can be used to dispose of the tool.
11274
11682
  */
11275
- export function MakeModularTool(options: ModularToolOptions): BABYLON.IDisposable;
11683
+ export function MakeModularTool(options: ModularToolOptions): {
11684
+ dispose: () => Promise<void>;
11685
+ };
11686
+
11687
+
11688
+
11689
+ }
11690
+ declare namespace BABYLON.NodeEditor {
11691
+
11692
+
11693
+ }
11694
+ declare namespace BABYLON.NodeEditor.SharedUIComponents {
11695
+ /**
11696
+ * Options for creating a modular bridge container.
11697
+ * @experimental
11698
+ * @internal
11699
+ */
11700
+ export type ModularBridgeOptions = {
11701
+ /**
11702
+ * WebSocket port for the bridge's browser port. Defaults to 4400.
11703
+ */
11704
+ port?: number;
11705
+ /**
11706
+ * Session display name reported to the bridge. Defaults to `document.title`.
11707
+ */
11708
+ name?: string;
11709
+ /**
11710
+ * Whether the bridge should automatically enable trying to connect.
11711
+ * Defaults to true.
11712
+ */
11713
+ autoEnable?: boolean;
11714
+ /**
11715
+ * Additional service definitions to register with the bridge container.
11716
+ */
11717
+ serviceDefinitions?: readonly BABYLON.NodeEditor.SharedUIComponents.WeaklyTypedServiceDefinition[];
11718
+ };
11719
+ /**
11720
+ * A token returned by {@link MakeModularBridge} that owns the headless
11721
+ * {@link BABYLON.NodeEditor.SharedUIComponents.ServiceContainer}. Dispose it to tear down the bridge and all services.
11722
+ * @experimental
11723
+ * @internal
11724
+ */
11725
+ export type ModularBridgeToken = BABYLON.IDisposable & {
11726
+ /**
11727
+ * The headless BABYLON.NodeEditor.SharedUIComponents.ServiceContainer that hosts the bridge.
11728
+ */
11729
+ readonly serviceContainer: BABYLON.NodeEditor.SharedUIComponents.ServiceContainer;
11730
+ /**
11731
+ * Whether this token has been disposed.
11732
+ */
11733
+ readonly isDisposed: boolean;
11734
+ };
11735
+ /**
11736
+ * Creates a headless {@link BABYLON.NodeEditor.SharedUIComponents.ServiceContainer} that hosts a bridge service.
11737
+ *
11738
+ * The returned token owns the container. Dispose it to tear down the bridge.
11739
+ *
11740
+ * @param options Optional configuration for the bridge.
11741
+ * @returns A {@link ModularBridgeToken} that owns the container.
11742
+ * @experimental
11743
+ * @internal
11744
+ */
11745
+ export function MakeModularBridge(options?: ModularBridgeOptions): ModularBridgeToken;
11276
11746
 
11277
11747
 
11278
11748
 
@@ -11792,6 +12262,376 @@ declare namespace BABYLON.NodeEditor.SharedUIComponents {
11792
12262
 
11793
12263
 
11794
12264
 
12265
+ }
12266
+ declare namespace BABYLON.NodeEditor {
12267
+
12268
+
12269
+ }
12270
+ declare namespace BABYLON.NodeEditor.SharedUIComponents {
12271
+ /**
12272
+ * Serializable description of a command argument, used in protocol messages.
12273
+ */
12274
+ export type CommandArgInfo = {
12275
+ /** The name of the argument. */
12276
+ name: string;
12277
+ /** A human-readable description of the argument. */
12278
+ description: string;
12279
+ /** Whether this argument is required. */
12280
+ required?: boolean;
12281
+ /** The type of the argument. Defaults to "string". When "file", the CLI reads the file and sends its contents. */
12282
+ type?: "string" | "file";
12283
+ };
12284
+ /**
12285
+ * Serializable description of a command, used in protocol messages.
12286
+ */
12287
+ export type CommandInfo = {
12288
+ /** A unique identifier for the command. */
12289
+ id: string;
12290
+ /** A human-readable description of the command. */
12291
+ description: string;
12292
+ /** The arguments this command accepts. */
12293
+ args?: CommandArgInfo[];
12294
+ };
12295
+ /**
12296
+ * Serializable description of a session, used in protocol messages.
12297
+ */
12298
+ export type SessionInfo = {
12299
+ /** The numeric session identifier. */
12300
+ id: number;
12301
+ /** The display name of the session. */
12302
+ name: string;
12303
+ /** ISO 8601 timestamp of when the session connected. */
12304
+ connectedAt: string;
12305
+ };
12306
+ /**
12307
+ * CLI → Bridge: Request the list of active browser sessions.
12308
+ */
12309
+ export type SessionsRequest = {
12310
+ /** The message type discriminator. */
12311
+ type: "sessions";
12312
+ };
12313
+ /**
12314
+ * CLI → Bridge: Request the list of commands available from a session.
12315
+ */
12316
+ export type CommandsRequest = {
12317
+ /** The message type discriminator. */
12318
+ type: "commands";
12319
+ /** The session to query for commands. */
12320
+ sessionId: number;
12321
+ };
12322
+ /**
12323
+ * CLI → Bridge: Execute a command on a session.
12324
+ */
12325
+ export type ExecRequest = {
12326
+ /** The message type discriminator. */
12327
+ type: "exec";
12328
+ /** The session to execute the command on. */
12329
+ sessionId: number;
12330
+ /** The identifier of the command to execute. */
12331
+ commandId: string;
12332
+ /** Key-value pairs of arguments for the command. */
12333
+ args: Record<string, string>;
12334
+ };
12335
+ /**
12336
+ * CLI → Bridge: Stop the bridge process.
12337
+ */
12338
+ export type StopRequest = {
12339
+ /** The message type discriminator. */
12340
+ type: "stop";
12341
+ };
12342
+ /**
12343
+ * All messages that the CLI sends to the bridge.
12344
+ */
12345
+ export type CliRequest = SessionsRequest | CommandsRequest | ExecRequest | StopRequest;
12346
+ /**
12347
+ * Bridge → CLI: Response with the list of active sessions.
12348
+ */
12349
+ export type SessionsResponse = {
12350
+ /** The message type discriminator. */
12351
+ type: "sessionsResponse";
12352
+ /** The list of active sessions. */
12353
+ sessions: SessionInfo[];
12354
+ };
12355
+ /**
12356
+ * Bridge → CLI: Response with the list of commands from a session.
12357
+ */
12358
+ export type CommandsResponse = {
12359
+ /** The message type discriminator. */
12360
+ type: "commandsResponse";
12361
+ /** The list of available commands, if successful. */
12362
+ commands?: CommandInfo[];
12363
+ /** An error message, if the request failed. */
12364
+ error?: string;
12365
+ };
12366
+ /**
12367
+ * Bridge → CLI: Response with the result of a command execution.
12368
+ */
12369
+ export type ExecResponse = {
12370
+ /** The message type discriminator. */
12371
+ type: "execResponse";
12372
+ /** The result of the command execution, if successful. */
12373
+ result?: string;
12374
+ /** An error message, if the execution failed. */
12375
+ error?: string;
12376
+ };
12377
+ /**
12378
+ * Bridge → CLI: Acknowledgement that the bridge is stopping.
12379
+ */
12380
+ export type StopResponse = {
12381
+ /** The message type discriminator. */
12382
+ type: "stopResponse";
12383
+ /** Whether the bridge stopped successfully. */
12384
+ success: boolean;
12385
+ };
12386
+ /**
12387
+ * All messages that the bridge sends to the CLI.
12388
+ */
12389
+ export type CliResponse = SessionsResponse | CommandsResponse | ExecResponse | StopResponse;
12390
+ /**
12391
+ * Browser → Bridge: Register a new session.
12392
+ */
12393
+ export type RegisterRequest = {
12394
+ /** The message type discriminator. */
12395
+ type: "register";
12396
+ /** The display name for this session. */
12397
+ name: string;
12398
+ };
12399
+ /**
12400
+ * Browser → Bridge: Response to a listCommands request from the bridge.
12401
+ */
12402
+ export type CommandListResponse = {
12403
+ /** The message type discriminator. */
12404
+ type: "commandListResponse";
12405
+ /** The identifier of the original request. */
12406
+ requestId: string;
12407
+ /** The list of registered commands. */
12408
+ commands: CommandInfo[];
12409
+ };
12410
+ /**
12411
+ * Browser → Bridge: Response to an execCommand request from the bridge.
12412
+ */
12413
+ export type CommandResponse = {
12414
+ /** The message type discriminator. */
12415
+ type: "commandResponse";
12416
+ /** The identifier of the original request. */
12417
+ requestId: string;
12418
+ /** The result of the command execution, if successful. */
12419
+ result?: string;
12420
+ /** An error message, if the execution failed. */
12421
+ error?: string;
12422
+ };
12423
+ /**
12424
+ * Browser → Bridge: Response to a getInfo request from the bridge.
12425
+ */
12426
+ export type InfoResponse = {
12427
+ /** The message type discriminator. */
12428
+ type: "infoResponse";
12429
+ /** The identifier of the original request. */
12430
+ requestId: string;
12431
+ /** The current display name of the session. */
12432
+ name: string;
12433
+ };
12434
+ /**
12435
+ * All messages that the browser sends to the bridge.
12436
+ */
12437
+ export type BrowserRequest = RegisterRequest | CommandListResponse | CommandResponse | InfoResponse;
12438
+ /**
12439
+ * Bridge → Browser: Request the list of registered commands.
12440
+ */
12441
+ export type ListCommandsRequest = {
12442
+ /** The message type discriminator. */
12443
+ type: "listCommands";
12444
+ /** A unique identifier for this request. */
12445
+ requestId: string;
12446
+ };
12447
+ /**
12448
+ * Bridge → Browser: Request execution of a command.
12449
+ */
12450
+ export type ExecCommandRequest = {
12451
+ /** The message type discriminator. */
12452
+ type: "execCommand";
12453
+ /** A unique identifier for this request. */
12454
+ requestId: string;
12455
+ /** The identifier of the command to execute. */
12456
+ commandId: string;
12457
+ /** Key-value pairs of arguments for the command. */
12458
+ args: Record<string, string>;
12459
+ };
12460
+ /**
12461
+ * Bridge → Browser: Request current session information.
12462
+ */
12463
+ export type GetInfoRequest = {
12464
+ /** The message type discriminator. */
12465
+ type: "getInfo";
12466
+ /** A unique identifier for this request. */
12467
+ requestId: string;
12468
+ };
12469
+ /**
12470
+ * All messages that the bridge sends to the browser.
12471
+ */
12472
+ export type BrowserResponse = ListCommandsRequest | ExecCommandRequest | GetInfoRequest;
12473
+
12474
+
12475
+
12476
+ }
12477
+ declare namespace BABYLON.NodeEditor {
12478
+
12479
+
12480
+ }
12481
+ declare namespace BABYLON.NodeEditor.SharedUIComponents {
12482
+ /**
12483
+ * Options for the CLI bridge service.
12484
+ * @experimental
12485
+ * @internal
12486
+ */
12487
+ export type BridgeServiceOptions = {
12488
+ /**
12489
+ * The WebSocket port for the bridge's browser port.
12490
+ */
12491
+ port: number;
12492
+ /**
12493
+ * The session display name sent to the bridge.
12494
+ * Can be a getter to provide a dynamic value that is re-read
12495
+ * each time the bridge queries session information.
12496
+ */
12497
+ name: string;
12498
+ /**
12499
+ * Whether to automatically enable connecting when the service is created.
12500
+ */
12501
+ autoEnable: boolean;
12502
+ };
12503
+ /**
12504
+ * Creates the service definition for the CLI Bridge Service.
12505
+ * @param options The options for connecting to the bridge.
12506
+ * @returns A service definition that produces an BABYLON.NodeEditor.SharedUIComponents.IBridgeCommandRegistry and BABYLON.NodeEditor.SharedUIComponents.ICliConnectionStatus.
12507
+ * @experimental
12508
+ * @internal
12509
+ */
12510
+ export function MakeBridgeServiceDefinition(options: BridgeServiceOptions): BABYLON.NodeEditor.SharedUIComponents.ServiceDefinition<[IBridgeCommandRegistry, BABYLON.NodeEditor.SharedUIComponents.ICliConnectionStatus], []>;
12511
+
12512
+
12513
+
12514
+ }
12515
+ declare namespace BABYLON.NodeEditor {
12516
+
12517
+
12518
+ }
12519
+ declare namespace BABYLON.NodeEditor.SharedUIComponents {
12520
+ /**
12521
+ * The service identity for the CLI connection status.
12522
+ * @experimental
12523
+ * @internal
12524
+ */
12525
+ export var CliConnectionStatusIdentity: unique symbol;
12526
+ /**
12527
+ * Provides the connection status and enable/disable control for the CLI bridge.
12528
+ * @experimental
12529
+ * @internal
12530
+ */
12531
+ export interface ICliConnectionStatus extends BABYLON.NodeEditor.SharedUIComponents.IService<typeof CliConnectionStatusIdentity> {
12532
+ /**
12533
+ * Whether the bridge is enabled. When true, the bridge actively tries to
12534
+ * maintain a WebSocket connection. When false, the bridge is disconnected
12535
+ * and idle.
12536
+ */
12537
+ isEnabled: boolean;
12538
+ /**
12539
+ * Whether the bridge WebSocket is currently connected.
12540
+ */
12541
+ readonly isConnected: boolean;
12542
+ /**
12543
+ * Observable that fires when either {@link isEnabled} or {@link isConnected} changes.
12544
+ */
12545
+ readonly onConnectionStatusChanged: BABYLON.IReadonlyObservable<void>;
12546
+ }
12547
+
12548
+
12549
+
12550
+ }
12551
+ declare namespace BABYLON.NodeEditor {
12552
+
12553
+
12554
+ }
12555
+ declare namespace BABYLON.NodeEditor.SharedUIComponents {
12556
+ /**
12557
+ * The type of a bridge command argument, which determines how
12558
+ * the CLI processes the value before sending it to the browser.
12559
+ * @experimental
12560
+ * @internal
12561
+ */
12562
+ export type BridgeCommandArgType = "string" | "file";
12563
+ /**
12564
+ * Describes an argument for a bridge command.
12565
+ * @experimental
12566
+ * @internal
12567
+ */
12568
+ export type BridgeCommandArg = {
12569
+ /**
12570
+ * The name of the argument.
12571
+ */
12572
+ name: string;
12573
+ /**
12574
+ * A description of the argument.
12575
+ */
12576
+ description: string;
12577
+ /**
12578
+ * Whether the argument is required.
12579
+ */
12580
+ required?: boolean;
12581
+ /**
12582
+ * The type of the argument. Defaults to "string".
12583
+ * When set to "file", the CLI reads the file at the given path
12584
+ * and passes its contents as the argument value.
12585
+ */
12586
+ type?: BridgeCommandArgType;
12587
+ };
12588
+ /**
12589
+ * Describes a command that can be invoked from the bridge.
12590
+ * @experimental
12591
+ * @internal
12592
+ */
12593
+ export type BridgeCommandDescriptor = {
12594
+ /**
12595
+ * A unique identifier for the command.
12596
+ */
12597
+ id: string;
12598
+ /**
12599
+ * A human-readable description of what the command does.
12600
+ */
12601
+ description: string;
12602
+ /**
12603
+ * The arguments that this command accepts.
12604
+ */
12605
+ args?: BridgeCommandArg[];
12606
+ /**
12607
+ * Executes the command with the given arguments and returns a result string.
12608
+ * @param args A map of argument names to their values.
12609
+ * @returns A promise that resolves to the result string.
12610
+ */
12611
+ executeAsync: (args: Record<string, string>) => Promise<string>;
12612
+ };
12613
+ /**
12614
+ * The service identity for the bridge command registry.
12615
+ * @experimental
12616
+ * @internal
12617
+ */
12618
+ export var BridgeCommandRegistryIdentity: unique symbol;
12619
+ /**
12620
+ * A registry for commands that can be invoked from the bridge.
12621
+ * @experimental
12622
+ * @internal
12623
+ */
12624
+ export interface IBridgeCommandRegistry extends BABYLON.NodeEditor.SharedUIComponents.IService<typeof BridgeCommandRegistryIdentity> {
12625
+ /**
12626
+ * Registers a command that can be invoked from the bridge.
12627
+ * @param descriptor The command descriptor.
12628
+ * @returns A disposable token that unregisters the command when disposed.
12629
+ */
12630
+ addCommand(descriptor: BridgeCommandDescriptor): BABYLON.IDisposable;
12631
+ }
12632
+
12633
+
12634
+
11795
12635
  }
11796
12636
  declare namespace BABYLON.NodeEditor {
11797
12637
 
@@ -11819,14 +12659,13 @@ declare namespace BABYLON.NodeEditor.SharedUIComponents {
11819
12659
  [Index in keyof ServiceContracts]: ExtractContractIdentity<ServiceContracts[Index]>;
11820
12660
  };
11821
12661
  type UnionToIntersection<Union> = (Union extends any ? (k: Union) => void : never) extends (k: infer Intersection) => void ? Intersection : never;
11822
- type MaybePromise<T> = T | Promise<T>;
11823
12662
  /**
11824
12663
  * A factory function responsible for creating a service instance.
11825
12664
  * Consumed services are passed as arguments to the factory function.
11826
- * The returned value must implement all produced services, and may BABYLON.IDisposable.
11827
- * If not services are produced, the returned value may implement BABYLON.IDisposable, otherwise it may return void.
12665
+ * The returned value must implement all produced services, and may implement BABYLON.IDisposable.
12666
+ * If no services are produced, the returned value may implement BABYLON.IDisposable, otherwise it may return void.
11828
12667
  */
11829
- export type ServiceFactory<Produces extends IService<symbol>[], Consumes extends IService<symbol>[]> = (...dependencies: [...Consumes, abortSignal?: AbortSignal]) => MaybePromise<Produces extends [] ? Partial<BABYLON.IDisposable> | void : Partial<BABYLON.IDisposable> & UnionToIntersection<Produces[number]>>;
12668
+ export type ServiceFactory<Produces extends IService<symbol>[], Consumes extends IService<symbol>[]> = (...dependencies: [...Consumes]) => Produces extends [] ? Partial<BABYLON.IDisposable> | void : Partial<BABYLON.IDisposable> & UnionToIntersection<Produces[number]>;
11830
12669
  /**
11831
12670
  * 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).
11832
12671
  */
@@ -11895,20 +12734,19 @@ declare namespace BABYLON.NodeEditor.SharedUIComponents {
11895
12734
  */
11896
12735
  constructor(_friendlyName: string, _parent?: ServiceContainer | undefined);
11897
12736
  /**
11898
- * Adds a set of service definitions in the service container.
12737
+ * Adds a set of service definitions to the service container.
11899
12738
  * The services are sorted based on their dependencies.
11900
- * @param args The service definitions to register, and optionally an abort signal.
11901
- * @returns A disposable that will remove the service definition from the service container.
12739
+ * @param serviceDefinitions The service definitions to register.
12740
+ * @returns A disposable that will remove the service definitions from the service container.
11902
12741
  */
11903
- addServicesAsync(...args: WeaklyTypedServiceDefinition[] | [...serviceDefinitions: WeaklyTypedServiceDefinition[], abortSignal: AbortSignal]): Promise<BABYLON.IDisposable>;
12742
+ addServices(...serviceDefinitions: WeaklyTypedServiceDefinition[]): BABYLON.IDisposable;
11904
12743
  /**
11905
12744
  * Registers a service definition in the service container.
11906
12745
  * @param serviceDefinition The service definition to register.
11907
- * @param abortSignal An optional abort signal.
11908
12746
  * @returns A disposable that will remove the service definition from the service container.
11909
12747
  */
11910
- addServiceAsync<Produces extends BABYLON.NodeEditor.SharedUIComponents.IService<symbol>[] = [], Consumes extends BABYLON.NodeEditor.SharedUIComponents.IService<symbol>[] = []>(serviceDefinition: BABYLON.NodeEditor.SharedUIComponents.ServiceDefinition<Produces, Consumes>, abortSignal?: AbortSignal): Promise<BABYLON.IDisposable>;
11911
- private _addServiceAsync;
12748
+ addService<Produces extends BABYLON.NodeEditor.SharedUIComponents.IService<symbol>[] = [], Consumes extends BABYLON.NodeEditor.SharedUIComponents.IService<symbol>[] = []>(serviceDefinition: BABYLON.NodeEditor.SharedUIComponents.ServiceDefinition<Produces, Consumes>): BABYLON.IDisposable;
12749
+ private _addService;
11912
12750
  /**
11913
12751
  * Resolves a dependency by contract identity for a consuming service.
11914
12752
  * Checks local services first, then walks up the parent chain.