@babylonjs/inspector 9.1.0 → 9.2.0
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.
- package/bin/inspector-bridge.mjs +4734 -0
- package/bin/inspector-cli.mjs +4931 -0
- package/lib/cli/protocol.d.ts +180 -0
- package/lib/components/properties/materials/openpbrMaterialProperties.d.ts +3 -0
- package/lib/{extensionsListService-BmiNjZiw.js → extensionsListService-eRZtqcfj.js} +3 -3
- package/lib/{extensionsListService-BmiNjZiw.js.map → extensionsListService-eRZtqcfj.js.map} +1 -1
- package/lib/{index-BCbXjPTn.js → index-FWuITINA.js} +1134 -266
- package/lib/index-FWuITINA.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +2 -2
- package/lib/inspectable.d.ts +67 -0
- package/lib/misc/defaultPerfStrategies.d.ts +16 -0
- package/lib/modularTool.d.ts +6 -1
- package/lib/modularity/serviceContainer.d.ts +24 -1
- package/lib/{quickCreateToolsService-BoqrJqoM.js → quickCreateToolsService-MzZbVrvr.js} +3 -3
- package/lib/{quickCreateToolsService-BoqrJqoM.js.map → quickCreateToolsService-MzZbVrvr.js.map} +1 -1
- package/lib/{reflectorService-CFTva2GG.js → reflectorService-DdPEZLjO.js} +3 -3
- package/lib/{reflectorService-CFTva2GG.js.map → reflectorService-DdPEZLjO.js.map} +1 -1
- package/lib/services/cli/cliConnectionStatus.d.ts +19 -0
- package/lib/services/cli/entityQueryService.d.ts +8 -0
- package/lib/services/cli/inspectableBridgeService.d.ts +22 -0
- package/lib/services/cli/inspectableCommandRegistry.d.ts +58 -0
- package/lib/services/cli/perfTraceCommandService.d.ts +9 -0
- package/lib/services/cli/screenshotCommandService.d.ts +8 -0
- package/lib/services/cli/shaderCommandService.d.ts +7 -0
- package/lib/services/cli/statsCommandService.d.ts +9 -0
- package/lib/services/cliConnectionStatusService.d.ts +4 -0
- package/lib/services/defaultToolbarMetadata.d.ts +2 -1
- package/package.json +11 -4
- package/readme.md +27 -0
- package/lib/index-BCbXjPTn.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reflectorService-
|
|
1
|
+
{"version":3,"file":"reflectorService-DdPEZLjO.js","sources":["../../../../../../../../dev/inspector-v2/src/components/tools/reflectorTools.tsx","../../../../../../../../dev/inspector-v2/src/services/panes/tools/reflectorService.tsx"],"sourcesContent":["import { ButtonLine } from \"shared-ui-components/fluent/hoc/buttonLine\";\r\nimport { useState, useCallback, useRef, type FunctionComponent } from \"react\";\r\nimport { type Scene } from \"core/scene\";\r\nimport { TextInputPropertyLine, NumberInputPropertyLine } from \"shared-ui-components/fluent/hoc/propertyLines/inputPropertyLine\";\r\nimport { Reflector } from \"core/Misc/reflector\";\r\nimport { PlugConnectedRegular } from \"@fluentui/react-icons\";\r\n\r\nexport const ReflectorTools: FunctionComponent<{ scene: Scene }> = ({ scene }) => {\r\n const [hostname, setHostname] = useState(\"localhost\");\r\n const [port, setPort] = useState(1234);\r\n const reflectorRef = useRef<Reflector | null>(null);\r\n\r\n const connectReflector = useCallback(() => {\r\n if (reflectorRef.current) {\r\n reflectorRef.current.close();\r\n }\r\n\r\n reflectorRef.current = new Reflector(scene, hostname, port);\r\n }, [scene, hostname, port]);\r\n\r\n return (\r\n <>\r\n <TextInputPropertyLine label=\"Hostname\" value={hostname} onChange={(value) => setHostname(value)} />\r\n <NumberInputPropertyLine label=\"Port\" value={port} onChange={(value) => setPort(value)} forceInt />\r\n <ButtonLine label=\"Connect\" icon={PlugConnectedRegular} onClick={connectReflector} />\r\n </>\r\n );\r\n};\r\n","import { type ServiceDefinition } from \"../../../modularity/serviceDefinition\";\r\nimport { ToolsServiceIdentity, type IToolsService } from \"../toolsService\";\r\nimport { type IDisposable } from \"core/scene\";\r\nimport { ReflectorTools } from \"../../../components/tools/reflectorTools\";\r\n\r\nexport const ReflectorServiceDefinition: ServiceDefinition<[], [IToolsService]> = {\r\n friendlyName: \"Reflector Tools\",\r\n consumes: [ToolsServiceIdentity],\r\n factory: (toolsService) => {\r\n const contentRegistrations: IDisposable[] = [];\r\n\r\n // Reflector content\r\n contentRegistrations.push(\r\n toolsService.addSectionContent({\r\n key: \"Reflector\",\r\n section: \"Reflector\",\r\n component: ({ context }) => <ReflectorTools scene={context} />,\r\n })\r\n );\r\n\r\n return {\r\n dispose: () => {\r\n contentRegistrations.forEach((registration) => registration.dispose());\r\n },\r\n };\r\n },\r\n};\r\n\r\nexport default {\r\n serviceDefinitions: [ReflectorServiceDefinition],\r\n} as const;\r\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOO,MAAM,cAAc,GAAwC,CAAC,EAAE,KAAK,EAAE,KAAI;IAC7E,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC;IACrD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC;AACtC,IAAA,MAAM,YAAY,GAAG,MAAM,CAAmB,IAAI,CAAC;AAEnD,IAAA,MAAM,gBAAgB,GAAG,WAAW,CAAC,MAAK;AACtC,QAAA,IAAI,YAAY,CAAC,OAAO,EAAE;AACtB,YAAA,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE;QAChC;AAEA,QAAA,YAAY,CAAC,OAAO,GAAG,IAAI,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC;IAC/D,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;AAE3B,IAAA,QACIA,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACIC,GAAA,CAAC,qBAAqB,IAAC,KAAK,EAAC,UAAU,E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
+
* The service identity for the CLI connection status.
|
|
5
|
+
*/
|
|
6
|
+
export declare const CliConnectionStatusIdentity: unique symbol;
|
|
7
|
+
/**
|
|
8
|
+
* Provides the connection status of the Inspector CLI bridge.
|
|
9
|
+
*/
|
|
10
|
+
export interface ICliConnectionStatus extends IService<typeof CliConnectionStatusIdentity> {
|
|
11
|
+
/**
|
|
12
|
+
* Whether the bridge WebSocket is currently connected.
|
|
13
|
+
*/
|
|
14
|
+
readonly isConnected: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Observable that fires when the connection status changes.
|
|
17
|
+
*/
|
|
18
|
+
readonly onConnectionStatusChanged: IReadonlyObservable<boolean>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ServiceDefinition } from "../../modularity/serviceDefinition";
|
|
2
|
+
import { type ISceneContext } from "../sceneContext";
|
|
3
|
+
import { type IInspectableCommandRegistry } from "./inspectableCommandRegistry";
|
|
4
|
+
/**
|
|
5
|
+
* Service that registers CLI commands for querying scene entities by uniqueId.
|
|
6
|
+
* When uniqueId is omitted, returns a summary list of all entities of that type.
|
|
7
|
+
*/
|
|
8
|
+
export declare const EntityQueryServiceDefinition: ServiceDefinition<[], [IInspectableCommandRegistry, ISceneContext]>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ServiceDefinition } from "../../modularity/serviceDefinition";
|
|
2
|
+
import { type ICliConnectionStatus } from "./cliConnectionStatus";
|
|
3
|
+
import { type IInspectableCommandRegistry } from "./inspectableCommandRegistry";
|
|
4
|
+
/**
|
|
5
|
+
* Options for the inspectable bridge service.
|
|
6
|
+
*/
|
|
7
|
+
export interface IInspectableBridgeServiceOptions {
|
|
8
|
+
/**
|
|
9
|
+
* The WebSocket port for the bridge's browser port.
|
|
10
|
+
*/
|
|
11
|
+
port: number;
|
|
12
|
+
/**
|
|
13
|
+
* The session display name sent to the bridge.
|
|
14
|
+
*/
|
|
15
|
+
name: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates the service definition for the InspectableBridgeService.
|
|
19
|
+
* @param options The options for connecting to the bridge.
|
|
20
|
+
* @returns A service definition that produces an IInspectableCommandRegistry.
|
|
21
|
+
*/
|
|
22
|
+
export declare function MakeInspectableBridgeServiceDefinition(options: IInspectableBridgeServiceOptions): ServiceDefinition<[IInspectableCommandRegistry, ICliConnectionStatus], []>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type IDisposable } from "@babylonjs/core/index.js";
|
|
2
|
+
import { type IService } from "../../modularity/serviceDefinition";
|
|
3
|
+
/**
|
|
4
|
+
* Describes an argument for an inspectable command.
|
|
5
|
+
*/
|
|
6
|
+
export type InspectableCommandArg = {
|
|
7
|
+
/**
|
|
8
|
+
* The name of the argument.
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
/**
|
|
12
|
+
* A description of the argument.
|
|
13
|
+
*/
|
|
14
|
+
description: string;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the argument is required.
|
|
17
|
+
*/
|
|
18
|
+
required?: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Describes a command that can be invoked from the CLI.
|
|
22
|
+
*/
|
|
23
|
+
export type InspectableCommandDescriptor = {
|
|
24
|
+
/**
|
|
25
|
+
* A unique identifier for the command.
|
|
26
|
+
*/
|
|
27
|
+
id: string;
|
|
28
|
+
/**
|
|
29
|
+
* A human-readable description of what the command does.
|
|
30
|
+
*/
|
|
31
|
+
description: string;
|
|
32
|
+
/**
|
|
33
|
+
* The arguments that this command accepts.
|
|
34
|
+
*/
|
|
35
|
+
args?: InspectableCommandArg[];
|
|
36
|
+
/**
|
|
37
|
+
* Executes the command with the given arguments and returns a result string.
|
|
38
|
+
* @param args A map of argument names to their values.
|
|
39
|
+
* @returns A promise that resolves to the result string.
|
|
40
|
+
*/
|
|
41
|
+
executeAsync: (args: Record<string, string>) => Promise<string>;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* The service identity for the inspectable command registry.
|
|
45
|
+
*/
|
|
46
|
+
export declare const InspectableCommandRegistryIdentity: unique symbol;
|
|
47
|
+
/**
|
|
48
|
+
* A registry for commands that can be invoked from the Inspector CLI.
|
|
49
|
+
* @experimental
|
|
50
|
+
*/
|
|
51
|
+
export interface IInspectableCommandRegistry extends IService<typeof InspectableCommandRegistryIdentity> {
|
|
52
|
+
/**
|
|
53
|
+
* Registers a command that can be invoked from the Inspector CLI.
|
|
54
|
+
* @param descriptor The command descriptor.
|
|
55
|
+
* @returns A disposable token that unregisters the command when disposed.
|
|
56
|
+
*/
|
|
57
|
+
addCommand(descriptor: InspectableCommandDescriptor): IDisposable;
|
|
58
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ServiceDefinition } from "../../modularity/serviceDefinition";
|
|
2
|
+
import { type ISceneContext } from "../sceneContext";
|
|
3
|
+
import { type IInspectableCommandRegistry } from "./inspectableCommandRegistry";
|
|
4
|
+
import "@babylonjs/core/Misc/PerformanceViewer/performanceViewerSceneExtension.js";
|
|
5
|
+
/**
|
|
6
|
+
* Service that registers CLI commands for performance tracing using the PerformanceViewerCollector.
|
|
7
|
+
* start-perf-trace begins collecting data, stop-perf-trace stops and returns the collected data as JSON.
|
|
8
|
+
*/
|
|
9
|
+
export declare const PerfTraceCommandServiceDefinition: ServiceDefinition<[], [IInspectableCommandRegistry, ISceneContext]>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ServiceDefinition } from "../../modularity/serviceDefinition";
|
|
2
|
+
import { type ISceneContext } from "../sceneContext";
|
|
3
|
+
import { type IInspectableCommandRegistry } from "./inspectableCommandRegistry";
|
|
4
|
+
/**
|
|
5
|
+
* Service that registers a CLI command for capturing a screenshot of the scene.
|
|
6
|
+
* Returns the image as a base64 data string, suitable for consumption by AI agents.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ScreenshotCommandServiceDefinition: ServiceDefinition<[], [IInspectableCommandRegistry, ISceneContext]>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ServiceDefinition } from "../../modularity/serviceDefinition";
|
|
2
|
+
import { type ISceneContext } from "../sceneContext";
|
|
3
|
+
import { type IInspectableCommandRegistry } from "./inspectableCommandRegistry";
|
|
4
|
+
/**
|
|
5
|
+
* Service that registers a CLI command for retrieving compiled shader code from a material.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ShaderCommandServiceDefinition: ServiceDefinition<[], [IInspectableCommandRegistry, ISceneContext]>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ServiceDefinition } from "../../modularity/serviceDefinition";
|
|
2
|
+
import { type ISceneContext } from "../sceneContext";
|
|
3
|
+
import { type IInspectableCommandRegistry } from "./inspectableCommandRegistry";
|
|
4
|
+
import "@babylonjs/core/Engines/AbstractEngine/abstractEngine.timeQuery.js";
|
|
5
|
+
import "@babylonjs/core/Engines/Extensions/engine.query.js";
|
|
6
|
+
/**
|
|
7
|
+
* Service that registers CLI commands for querying scene and engine statistics.
|
|
8
|
+
*/
|
|
9
|
+
export declare const StatsCommandServiceDefinition: ServiceDefinition<[], [IInspectableCommandRegistry, ISceneContext]>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ServiceDefinition } from "../modularity/serviceDefinition";
|
|
2
|
+
import { type ICliConnectionStatus } from "./cli/cliConnectionStatus";
|
|
3
|
+
import { type IShellService } from "./shellService";
|
|
4
|
+
export declare const CliConnectionStatusServiceDefinition: ServiceDefinition<[], [IShellService, ICliConnectionStatus]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babylonjs/inspector",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.0",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "lib/index.js",
|
|
6
6
|
"esnext": "lib/index.js",
|
|
@@ -12,7 +12,11 @@
|
|
|
12
12
|
},
|
|
13
13
|
"./package.json": "./package.json"
|
|
14
14
|
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"babylon-inspector": "./bin/inspector-cli.mjs"
|
|
17
|
+
},
|
|
15
18
|
"files": [
|
|
19
|
+
"bin/**/*.mjs",
|
|
16
20
|
"lib/**/*.js",
|
|
17
21
|
"lib/**/*.d.ts",
|
|
18
22
|
"lib/**/*.map",
|
|
@@ -21,9 +25,10 @@
|
|
|
21
25
|
],
|
|
22
26
|
"scripts": {
|
|
23
27
|
"build": "npm run clean && npm run bundle",
|
|
24
|
-
"clean": "rimraf lib && rimraf dist && rimraf *.tsbuildinfo -g",
|
|
25
|
-
"bundle": "npm run bundle:lib",
|
|
28
|
+
"clean": "rimraf lib && rimraf bin && rimraf dist && rimraf *.tsbuildinfo -g",
|
|
29
|
+
"bundle": "npm run bundle:lib && npm run bundle:cli",
|
|
26
30
|
"bundle:lib": "rollup -c rollup.config.lib.mjs && tsc -p tsconfig.build.dts.json && build-tools -c tp --outDir ./lib --buildType es6 --basePackage @babylonjs/inspector --appendJS",
|
|
31
|
+
"bundle:cli": "rollup -c rollup.config.cli.mjs",
|
|
27
32
|
"pack": "npm run build && npm pack"
|
|
28
33
|
},
|
|
29
34
|
"peerDependencies": {
|
|
@@ -48,9 +53,11 @@
|
|
|
48
53
|
"@rollup/plugin-commonjs": "^26.0.1",
|
|
49
54
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
50
55
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
56
|
+
"@types/ws": "^8.5.0",
|
|
51
57
|
"chalk": "^5.3.0",
|
|
52
58
|
"rollup": "^4.59.0",
|
|
53
|
-
"rollup-plugin-dts": "^6.1.1"
|
|
59
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
60
|
+
"ws": "^8.18.0"
|
|
54
61
|
},
|
|
55
62
|
"keywords": [
|
|
56
63
|
"3D",
|
package/readme.md
CHANGED
|
@@ -21,3 +21,30 @@ import { ShowInspector } from "@babylonjs/inspector";
|
|
|
21
21
|
|
|
22
22
|
ShowInspector(scene);
|
|
23
23
|
```
|
|
24
|
+
|
|
25
|
+
## Headless Inspectable (No UI)
|
|
26
|
+
|
|
27
|
+
You can make a scene inspectable for the CLI without showing the Inspector UI by calling `StartInspectable`:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { StartInspectable } from "@babylonjs/inspector";
|
|
31
|
+
|
|
32
|
+
// Your code that sets up a Babylon.js scene...
|
|
33
|
+
|
|
34
|
+
const token = StartInspectable(scene);
|
|
35
|
+
|
|
36
|
+
// When you're done, dispose the token to disconnect:
|
|
37
|
+
token.dispose();
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`StartInspectable` connects the scene to the Inspector CLI bridge, enabling CLI commands like querying entities, taking screenshots, and capturing performance traces — all without rendering any Inspector UI. `ShowInspector` automatically calls `StartInspectable` internally.
|
|
41
|
+
|
|
42
|
+
## Inspector CLI
|
|
43
|
+
|
|
44
|
+
While the Inspector UI is designed for humans, the Inspector CLI is designed for AI agents. It provides machine-friendly JSON output for querying scene entities, capturing screenshots, collecting performance data, and more.
|
|
45
|
+
|
|
46
|
+
To get started:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx babylon-inspector --help
|
|
50
|
+
```
|