@onerjs/inspector 8.50.2 → 8.50.3

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.
@@ -6657,7 +6657,6 @@ export interface IDisplayManager {
6657
6657
 
6658
6658
  }
6659
6659
  declare module "@onerjs/inspector/modularTool/modularTool" {
6660
- import { IDisposable } from "@onerjs/core/index";
6661
6660
  import { IExtensionFeed } from "@onerjs/inspector/modularTool/extensibility/extensionFeed";
6662
6661
  import { WeaklyTypedServiceDefinition, ServiceContainer } from "@onerjs/inspector/modularTool/modularity/serviceContainer";
6663
6662
  import { ShellServiceOptions } from "@onerjs/inspector/modularTool/services/shellService";
@@ -6698,7 +6697,65 @@ export type ModularToolOptions = {
6698
6697
  * @param options The options for the tool.
6699
6698
  * @returns A token that can be used to dispose of the tool.
6700
6699
  */
6701
- export function MakeModularTool(options: ModularToolOptions): IDisposable;
6700
+ export function MakeModularTool(options: ModularToolOptions): {
6701
+ dispose: () => Promise<void>;
6702
+ };
6703
+
6704
+ }
6705
+ declare module "@onerjs/inspector/modularTool/modularBridge" {
6706
+ import { IDisposable } from "@onerjs/core/index";
6707
+ import { WeaklyTypedServiceDefinition, ServiceContainer } from "@onerjs/inspector/modularTool/modularity/serviceContainer";
6708
+ /**
6709
+ * Options for creating a modular bridge container.
6710
+ * @experimental
6711
+ * @internal
6712
+ */
6713
+ export type ModularBridgeOptions = {
6714
+ /**
6715
+ * WebSocket port for the bridge's browser port. Defaults to 4400.
6716
+ */
6717
+ port?: number;
6718
+ /**
6719
+ * Session display name reported to the bridge. Defaults to `document.title`.
6720
+ */
6721
+ name?: string;
6722
+ /**
6723
+ * Whether the bridge should automatically start trying to connect.
6724
+ * Defaults to false.
6725
+ */
6726
+ autoStart?: boolean;
6727
+ /**
6728
+ * Additional service definitions to register with the bridge container.
6729
+ */
6730
+ serviceDefinitions?: readonly WeaklyTypedServiceDefinition[];
6731
+ };
6732
+ /**
6733
+ * A token returned by {@link MakeModularBridge} that owns the headless
6734
+ * {@link ServiceContainer}. Dispose it to tear down the bridge and all services.
6735
+ * @experimental
6736
+ * @internal
6737
+ */
6738
+ export type ModularBridgeToken = IDisposable & {
6739
+ /**
6740
+ * The headless ServiceContainer that hosts the bridge.
6741
+ */
6742
+ readonly serviceContainer: ServiceContainer;
6743
+ /**
6744
+ * Whether this token has been disposed.
6745
+ */
6746
+ readonly isDisposed: boolean;
6747
+ };
6748
+ /**
6749
+ * Creates a headless {@link ServiceContainer} that hosts a bridge service.
6750
+ *
6751
+ * The returned token owns the container. Dispose it to tear down the bridge.
6752
+ *
6753
+ * @param options Optional configuration for the bridge.
6754
+ * @returns A {@link ModularBridgeToken} that owns the container.
6755
+ * @experimental
6756
+ * @internal
6757
+ */
6758
+ export function MakeModularBridge(options?: ModularBridgeOptions): ModularBridgeToken;
6702
6759
 
6703
6760
  }
6704
6761
  declare module "@onerjs/inspector/modularTool/themes/babylonTheme" {
@@ -7178,6 +7235,359 @@ import { ServiceDefinition } from "@onerjs/inspector/modularTool/modularity/serv
7178
7235
  import { IShellService } from "@onerjs/inspector/modularTool/services/shellService";
7179
7236
  export const ExtensionListServiceDefinition: ServiceDefinition<[], [IShellService]>;
7180
7237
 
7238
+ }
7239
+ declare module "@onerjs/inspector/modularTool/services/cli/protocol" {
7240
+ /**
7241
+ * Serializable description of a command argument, used in protocol messages.
7242
+ */
7243
+ export type CommandArgInfo = {
7244
+ /** The name of the argument. */
7245
+ name: string;
7246
+ /** A human-readable description of the argument. */
7247
+ description: string;
7248
+ /** Whether this argument is required. */
7249
+ required?: boolean;
7250
+ /** The type of the argument. Defaults to "string". When "file", the CLI reads the file and sends its contents. */
7251
+ type?: "string" | "file";
7252
+ };
7253
+ /**
7254
+ * Serializable description of a command, used in protocol messages.
7255
+ */
7256
+ export type CommandInfo = {
7257
+ /** A unique identifier for the command. */
7258
+ id: string;
7259
+ /** A human-readable description of the command. */
7260
+ description: string;
7261
+ /** The arguments this command accepts. */
7262
+ args?: CommandArgInfo[];
7263
+ };
7264
+ /**
7265
+ * Serializable description of a session, used in protocol messages.
7266
+ */
7267
+ export type SessionInfo = {
7268
+ /** The numeric session identifier. */
7269
+ id: number;
7270
+ /** The display name of the session. */
7271
+ name: string;
7272
+ /** ISO 8601 timestamp of when the session connected. */
7273
+ connectedAt: string;
7274
+ };
7275
+ /**
7276
+ * CLI → Bridge: Request the list of active browser sessions.
7277
+ */
7278
+ export type SessionsRequest = {
7279
+ /** The message type discriminator. */
7280
+ type: "sessions";
7281
+ };
7282
+ /**
7283
+ * CLI → Bridge: Request the list of commands available from a session.
7284
+ */
7285
+ export type CommandsRequest = {
7286
+ /** The message type discriminator. */
7287
+ type: "commands";
7288
+ /** The session to query for commands. */
7289
+ sessionId: number;
7290
+ };
7291
+ /**
7292
+ * CLI → Bridge: Execute a command on a session.
7293
+ */
7294
+ export type ExecRequest = {
7295
+ /** The message type discriminator. */
7296
+ type: "exec";
7297
+ /** The session to execute the command on. */
7298
+ sessionId: number;
7299
+ /** The identifier of the command to execute. */
7300
+ commandId: string;
7301
+ /** Key-value pairs of arguments for the command. */
7302
+ args: Record<string, string>;
7303
+ };
7304
+ /**
7305
+ * CLI → Bridge: Stop the bridge process.
7306
+ */
7307
+ export type StopRequest = {
7308
+ /** The message type discriminator. */
7309
+ type: "stop";
7310
+ };
7311
+ /**
7312
+ * All messages that the CLI sends to the bridge.
7313
+ */
7314
+ export type CliRequest = SessionsRequest | CommandsRequest | ExecRequest | StopRequest;
7315
+ /**
7316
+ * Bridge → CLI: Response with the list of active sessions.
7317
+ */
7318
+ export type SessionsResponse = {
7319
+ /** The message type discriminator. */
7320
+ type: "sessionsResponse";
7321
+ /** The list of active sessions. */
7322
+ sessions: SessionInfo[];
7323
+ };
7324
+ /**
7325
+ * Bridge → CLI: Response with the list of commands from a session.
7326
+ */
7327
+ export type CommandsResponse = {
7328
+ /** The message type discriminator. */
7329
+ type: "commandsResponse";
7330
+ /** The list of available commands, if successful. */
7331
+ commands?: CommandInfo[];
7332
+ /** An error message, if the request failed. */
7333
+ error?: string;
7334
+ };
7335
+ /**
7336
+ * Bridge → CLI: Response with the result of a command execution.
7337
+ */
7338
+ export type ExecResponse = {
7339
+ /** The message type discriminator. */
7340
+ type: "execResponse";
7341
+ /** The result of the command execution, if successful. */
7342
+ result?: string;
7343
+ /** An error message, if the execution failed. */
7344
+ error?: string;
7345
+ };
7346
+ /**
7347
+ * Bridge → CLI: Acknowledgement that the bridge is stopping.
7348
+ */
7349
+ export type StopResponse = {
7350
+ /** The message type discriminator. */
7351
+ type: "stopResponse";
7352
+ /** Whether the bridge stopped successfully. */
7353
+ success: boolean;
7354
+ };
7355
+ /**
7356
+ * All messages that the bridge sends to the CLI.
7357
+ */
7358
+ export type CliResponse = SessionsResponse | CommandsResponse | ExecResponse | StopResponse;
7359
+ /**
7360
+ * Browser → Bridge: Register a new session.
7361
+ */
7362
+ export type RegisterRequest = {
7363
+ /** The message type discriminator. */
7364
+ type: "register";
7365
+ /** The display name for this session. */
7366
+ name: string;
7367
+ };
7368
+ /**
7369
+ * Browser → Bridge: Response to a listCommands request from the bridge.
7370
+ */
7371
+ export type CommandListResponse = {
7372
+ /** The message type discriminator. */
7373
+ type: "commandListResponse";
7374
+ /** The identifier of the original request. */
7375
+ requestId: string;
7376
+ /** The list of registered commands. */
7377
+ commands: CommandInfo[];
7378
+ };
7379
+ /**
7380
+ * Browser → Bridge: Response to an execCommand request from the bridge.
7381
+ */
7382
+ export type CommandResponse = {
7383
+ /** The message type discriminator. */
7384
+ type: "commandResponse";
7385
+ /** The identifier of the original request. */
7386
+ requestId: string;
7387
+ /** The result of the command execution, if successful. */
7388
+ result?: string;
7389
+ /** An error message, if the execution failed. */
7390
+ error?: string;
7391
+ };
7392
+ /**
7393
+ * Browser → Bridge: Response to a getInfo request from the bridge.
7394
+ */
7395
+ export type InfoResponse = {
7396
+ /** The message type discriminator. */
7397
+ type: "infoResponse";
7398
+ /** The identifier of the original request. */
7399
+ requestId: string;
7400
+ /** The current display name of the session. */
7401
+ name: string;
7402
+ };
7403
+ /**
7404
+ * All messages that the browser sends to the bridge.
7405
+ */
7406
+ export type BrowserRequest = RegisterRequest | CommandListResponse | CommandResponse | InfoResponse;
7407
+ /**
7408
+ * Bridge → Browser: Request the list of registered commands.
7409
+ */
7410
+ export type ListCommandsRequest = {
7411
+ /** The message type discriminator. */
7412
+ type: "listCommands";
7413
+ /** A unique identifier for this request. */
7414
+ requestId: string;
7415
+ };
7416
+ /**
7417
+ * Bridge → Browser: Request execution of a command.
7418
+ */
7419
+ export type ExecCommandRequest = {
7420
+ /** The message type discriminator. */
7421
+ type: "execCommand";
7422
+ /** A unique identifier for this request. */
7423
+ requestId: string;
7424
+ /** The identifier of the command to execute. */
7425
+ commandId: string;
7426
+ /** Key-value pairs of arguments for the command. */
7427
+ args: Record<string, string>;
7428
+ };
7429
+ /**
7430
+ * Bridge → Browser: Request current session information.
7431
+ */
7432
+ export type GetInfoRequest = {
7433
+ /** The message type discriminator. */
7434
+ type: "getInfo";
7435
+ /** A unique identifier for this request. */
7436
+ requestId: string;
7437
+ };
7438
+ /**
7439
+ * All messages that the bridge sends to the browser.
7440
+ */
7441
+ export type BrowserResponse = ListCommandsRequest | ExecCommandRequest | GetInfoRequest;
7442
+
7443
+ }
7444
+ declare module "@onerjs/inspector/modularTool/services/cli/bridgeService" {
7445
+ import { ServiceDefinition } from "@onerjs/inspector/modularTool/modularity/serviceDefinition";
7446
+ import { ICliConnectionStatus } from "@onerjs/inspector/modularTool/services/cli/bridgeConnectionStatus";
7447
+ import { IBridgeCommandRegistry } from "@onerjs/inspector/modularTool/services/cli/bridgeCommandRegistry";
7448
+ /**
7449
+ * Options for the CLI bridge service.
7450
+ * @experimental
7451
+ * @internal
7452
+ */
7453
+ export type BridgeServiceOptions = {
7454
+ /**
7455
+ * The WebSocket port for the bridge's browser port.
7456
+ */
7457
+ port: number;
7458
+ /**
7459
+ * The session display name sent to the bridge.
7460
+ * Can be a getter to provide a dynamic value that is re-read
7461
+ * each time the bridge queries session information.
7462
+ */
7463
+ name: string;
7464
+ /**
7465
+ * Whether to automatically start connecting when the service is created.
7466
+ */
7467
+ autoStart: boolean;
7468
+ };
7469
+ /**
7470
+ * Creates the service definition for the CLI Bridge Service.
7471
+ * @param options The options for connecting to the bridge.
7472
+ * @returns A service definition that produces an IBridgeCommandRegistry and ICliConnectionStatus.
7473
+ * @experimental
7474
+ * @internal
7475
+ */
7476
+ export function MakeBridgeServiceDefinition(options: BridgeServiceOptions): ServiceDefinition<[IBridgeCommandRegistry, ICliConnectionStatus], []>;
7477
+
7478
+ }
7479
+ declare module "@onerjs/inspector/modularTool/services/cli/bridgeConnectionStatus" {
7480
+ import { IReadonlyObservable } from "@onerjs/core/index";
7481
+ import { IService } from "@onerjs/inspector/modularTool/modularity/serviceDefinition";
7482
+ /**
7483
+ * The service identity for the CLI connection status.
7484
+ * @experimental
7485
+ * @internal
7486
+ */
7487
+ export const CliConnectionStatusIdentity: unique symbol;
7488
+ /**
7489
+ * Provides the connection status and enable/disable control for the CLI bridge.
7490
+ * @experimental
7491
+ * @internal
7492
+ */
7493
+ export interface ICliConnectionStatus extends IService<typeof CliConnectionStatusIdentity> {
7494
+ /**
7495
+ * Whether the bridge is enabled. When true, the bridge actively tries to
7496
+ * maintain a WebSocket connection. When false, the bridge is disconnected
7497
+ * and idle.
7498
+ */
7499
+ isEnabled: boolean;
7500
+ /**
7501
+ * Whether the bridge WebSocket is currently connected.
7502
+ */
7503
+ readonly isConnected: boolean;
7504
+ /**
7505
+ * Observable that fires when either {@link isEnabled} or {@link isConnected} changes.
7506
+ */
7507
+ readonly onConnectionStatusChanged: IReadonlyObservable<void>;
7508
+ }
7509
+
7510
+ }
7511
+ declare module "@onerjs/inspector/modularTool/services/cli/bridgeCommandRegistry" {
7512
+ import { IDisposable } from "@onerjs/core/index";
7513
+ import { IService } from "@onerjs/inspector/modularTool/modularity/serviceDefinition";
7514
+ /**
7515
+ * The type of a bridge command argument, which determines how
7516
+ * the CLI processes the value before sending it to the browser.
7517
+ * @experimental
7518
+ * @internal
7519
+ */
7520
+ export type BridgeCommandArgType = "string" | "file";
7521
+ /**
7522
+ * Describes an argument for a bridge command.
7523
+ * @experimental
7524
+ * @internal
7525
+ */
7526
+ export type BridgeCommandArg = {
7527
+ /**
7528
+ * The name of the argument.
7529
+ */
7530
+ name: string;
7531
+ /**
7532
+ * A description of the argument.
7533
+ */
7534
+ description: string;
7535
+ /**
7536
+ * Whether the argument is required.
7537
+ */
7538
+ required?: boolean;
7539
+ /**
7540
+ * The type of the argument. Defaults to "string".
7541
+ * When set to "file", the CLI reads the file at the given path
7542
+ * and passes its contents as the argument value.
7543
+ */
7544
+ type?: BridgeCommandArgType;
7545
+ };
7546
+ /**
7547
+ * Describes a command that can be invoked from the bridge.
7548
+ * @experimental
7549
+ * @internal
7550
+ */
7551
+ export type BridgeCommandDescriptor = {
7552
+ /**
7553
+ * A unique identifier for the command.
7554
+ */
7555
+ id: string;
7556
+ /**
7557
+ * A human-readable description of what the command does.
7558
+ */
7559
+ description: string;
7560
+ /**
7561
+ * The arguments that this command accepts.
7562
+ */
7563
+ args?: BridgeCommandArg[];
7564
+ /**
7565
+ * Executes the command with the given arguments and returns a result string.
7566
+ * @param args A map of argument names to their values.
7567
+ * @returns A promise that resolves to the result string.
7568
+ */
7569
+ executeAsync: (args: Record<string, string>) => Promise<string>;
7570
+ };
7571
+ /**
7572
+ * The service identity for the bridge command registry.
7573
+ * @experimental
7574
+ * @internal
7575
+ */
7576
+ export const BridgeCommandRegistryIdentity: unique symbol;
7577
+ /**
7578
+ * A registry for commands that can be invoked from the bridge.
7579
+ * @experimental
7580
+ * @internal
7581
+ */
7582
+ export interface IBridgeCommandRegistry extends IService<typeof BridgeCommandRegistryIdentity> {
7583
+ /**
7584
+ * Registers a command that can be invoked from the bridge.
7585
+ * @param descriptor The command descriptor.
7586
+ * @returns A disposable token that unregisters the command when disposed.
7587
+ */
7588
+ addCommand(descriptor: BridgeCommandDescriptor): IDisposable;
7589
+ }
7590
+
7181
7591
  }
7182
7592
  declare module "@onerjs/inspector/modularTool/modularity/serviceDefinition" {
7183
7593
  import { IDisposable } from "@onerjs/core/index";
@@ -7202,14 +7612,13 @@ type ExtractContractIdentities<ServiceContracts extends IService<symbol>[]> = {
7202
7612
  [Index in keyof ServiceContracts]: ExtractContractIdentity<ServiceContracts[Index]>;
7203
7613
  };
7204
7614
  type UnionToIntersection<Union> = (Union extends any ? (k: Union) => void : never) extends (k: infer Intersection) => void ? Intersection : never;
7205
- type MaybePromise<T> = T | Promise<T>;
7206
7615
  /**
7207
7616
  * A factory function responsible for creating a service instance.
7208
7617
  * Consumed services are passed as arguments to the factory function.
7209
- * The returned value must implement all produced services, and may IDisposable.
7210
- * If not services are produced, the returned value may implement IDisposable, otherwise it may return void.
7618
+ * The returned value must implement all produced services, and may implement IDisposable.
7619
+ * If no services are produced, the returned value may implement IDisposable, otherwise it may return void.
7211
7620
  */
7212
- 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]>>;
7621
+ export type ServiceFactory<Produces extends IService<symbol>[], Consumes extends IService<symbol>[]> = (...dependencies: [...Consumes]) => Produces extends [] ? Partial<IDisposable> | void : Partial<IDisposable> & UnionToIntersection<Produces[number]>;
7213
7622
  /**
7214
7623
  * 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).
7215
7624
  */
@@ -7275,20 +7684,19 @@ export class ServiceContainer implements IDisposable {
7275
7684
  */
7276
7685
  constructor(_friendlyName: string, _parent?: ServiceContainer | undefined);
7277
7686
  /**
7278
- * Adds a set of service definitions in the service container.
7687
+ * Adds a set of service definitions to the service container.
7279
7688
  * The services are sorted based on their dependencies.
7280
- * @param args The service definitions to register, and optionally an abort signal.
7281
- * @returns A disposable that will remove the service definition from the service container.
7689
+ * @param serviceDefinitions The service definitions to register.
7690
+ * @returns A disposable that will remove the service definitions from the service container.
7282
7691
  */
7283
- addServicesAsync(...args: WeaklyTypedServiceDefinition[] | [...serviceDefinitions: WeaklyTypedServiceDefinition[], abortSignal: AbortSignal]): Promise<IDisposable>;
7692
+ addServices(...serviceDefinitions: WeaklyTypedServiceDefinition[]): IDisposable;
7284
7693
  /**
7285
7694
  * Registers a service definition in the service container.
7286
7695
  * @param serviceDefinition The service definition to register.
7287
- * @param abortSignal An optional abort signal.
7288
7696
  * @returns A disposable that will remove the service definition from the service container.
7289
7697
  */
7290
- addServiceAsync<Produces extends IService<symbol>[] = [], Consumes extends IService<symbol>[] = []>(serviceDefinition: ServiceDefinition<Produces, Consumes>, abortSignal?: AbortSignal): Promise<IDisposable>;
7291
- private _addServiceAsync;
7698
+ addService<Produces extends IService<symbol>[] = [], Consumes extends IService<symbol>[] = []>(serviceDefinition: ServiceDefinition<Produces, Consumes>): IDisposable;
7699
+ private _addService;
7292
7700
  /**
7293
7701
  * Resolves a dependency by contract identity for a consuming service.
7294
7702
  * Checks local services first, then walks up the parent chain.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onerjs/inspector",
3
- "version": "8.50.2",
3
+ "version": "8.50.3",
4
4
  "module": "dist/babylon.inspector.bundle.js",
5
5
  "main": "dist/babylon.inspector.bundle.js",
6
6
  "esnext": "dist/babylon.inspector.bundle.js",
@@ -34,13 +34,13 @@
34
34
  "@types/react-dom": ">=16.0.9"
35
35
  },
36
36
  "devDependencies": {
37
- "@onerjs/addons": "8.50.2",
38
- "@onerjs/core": "8.50.2",
39
- "@onerjs/gui": "8.50.2",
40
- "@onerjs/gui-editor": "8.50.2",
41
- "@onerjs/loaders": "8.50.2",
42
- "@onerjs/materials": "8.50.2",
43
- "@onerjs/serializers": "8.50.2",
37
+ "@onerjs/addons": "8.50.3",
38
+ "@onerjs/core": "8.50.3",
39
+ "@onerjs/gui": "8.50.3",
40
+ "@onerjs/gui-editor": "8.50.3",
41
+ "@onerjs/loaders": "8.50.3",
42
+ "@onerjs/materials": "8.50.3",
43
+ "@onerjs/serializers": "8.50.3",
44
44
  "@dev/gui": "1.0.0",
45
45
  "react": "^18.2.0",
46
46
  "react-dom": "^18.2.0"