@iwsdk/cli 0.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.
- package/LICENSE +21 -0
- package/README.md +12 -0
- package/dist/argv.d.ts +11 -0
- package/dist/argv.d.ts.map +1 -0
- package/dist/cli-results.d.ts +14 -0
- package/dist/cli-results.d.ts.map +1 -0
- package/dist/cli-types.d.ts +40 -0
- package/dist/cli-types.d.ts.map +1 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +23514 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/adapter.d.ts +19 -0
- package/dist/commands/adapter.d.ts.map +1 -0
- package/dist/commands/dev.d.ts +14 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/mcp.d.ts +10 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/reference.d.ts +12 -0
- package/dist/commands/reference.d.ts.map +1 -0
- package/dist/commands/runtime.d.ts +9 -0
- package/dist/commands/runtime.d.ts.map +1 -0
- package/dist/commands/status.d.ts +10 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/contract.js +874 -0
- package/dist/contract.js.map +1 -0
- package/dist/help.d.ts +11 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/hzdb-telemetry.d.ts +8 -0
- package/dist/hzdb-telemetry.d.ts.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23504 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-adapters.d.ts +52 -0
- package/dist/mcp-adapters.d.ts.map +1 -0
- package/dist/mcp-stdio.d.ts +14 -0
- package/dist/mcp-stdio.d.ts.map +1 -0
- package/dist/reference-runtime.d.ts +12 -0
- package/dist/reference-runtime.d.ts.map +1 -0
- package/dist/runtime-contract.d.ts +116 -0
- package/dist/runtime-contract.d.ts.map +1 -0
- package/dist/runtime-state.d.ts +51 -0
- package/dist/runtime-state.d.ts.map +1 -0
- package/dist/runtime-transport.d.ts +36 -0
- package/dist/runtime-transport.d.ts.map +1 -0
- package/package.json +65 -0
package/dist/contract.js
ADDED
|
@@ -0,0 +1,874 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
const IWSDK_PROJECT_STATE_DIR = '.iwsdk';
|
|
8
|
+
const IWSDK_RUNTIME_STATE_DIR = '.iwsdk/runtime';
|
|
9
|
+
const IWSDK_RUNTIME_LOGS_DIR = '.iwsdk/runtime/logs';
|
|
10
|
+
const IWSDK_RUNTIME_SESSION_PATH = '.iwsdk/runtime/session.json';
|
|
11
|
+
const IWSDK_RUNTIME_LAUNCH_PATH = '.iwsdk/runtime/launch.json';
|
|
12
|
+
const IWSDK_RUNTIME_STATE_SCHEMA_VERSION = 2;
|
|
13
|
+
const IWSDK_RUNTIME_BROWSER_READY_SCHEMA_VERSION = 2;
|
|
14
|
+
const INTERNAL_BROWSER_PROBE_METHOD = '__iwsdk_browser_probe';
|
|
15
|
+
function hasRuntimeBrowserCommandReadyContract(session) {
|
|
16
|
+
if (!session?.browser) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return (session.schemaVersion >= IWSDK_RUNTIME_BROWSER_READY_SCHEMA_VERSION ||
|
|
20
|
+
typeof session.browser.commandReady === 'boolean');
|
|
21
|
+
}
|
|
22
|
+
function isRuntimeBrowserCommandReady(session) {
|
|
23
|
+
if (!session?.browser) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
if (!hasRuntimeBrowserCommandReadyContract(session)) {
|
|
27
|
+
return session.browser.connected;
|
|
28
|
+
}
|
|
29
|
+
return session.browser.commandReady === true;
|
|
30
|
+
}
|
|
31
|
+
const SUPPORTED_AI_TOOLS = [
|
|
32
|
+
'claude',
|
|
33
|
+
'cursor',
|
|
34
|
+
'copilot',
|
|
35
|
+
'codex',
|
|
36
|
+
];
|
|
37
|
+
const MCP_CONFIG_TARGETS = {
|
|
38
|
+
claude: { file: '.mcp.json', jsonKey: 'mcpServers', format: 'json' },
|
|
39
|
+
cursor: { file: '.cursor/mcp.json', jsonKey: 'mcpServers', format: 'json' },
|
|
40
|
+
copilot: { file: '.vscode/mcp.json', jsonKey: 'servers', format: 'json' },
|
|
41
|
+
codex: { file: '.codex/config.toml', jsonKey: null, format: 'toml' },
|
|
42
|
+
};
|
|
43
|
+
const RUNTIME_MCP_TOOLS = [
|
|
44
|
+
// =============================================================================
|
|
45
|
+
// Session Management
|
|
46
|
+
// =============================================================================
|
|
47
|
+
{
|
|
48
|
+
name: 'xr_get_session_status',
|
|
49
|
+
description: 'Get XR session and device status',
|
|
50
|
+
inputSchema: {
|
|
51
|
+
type: 'object',
|
|
52
|
+
properties: {},
|
|
53
|
+
required: [],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'xr_accept_session',
|
|
58
|
+
description: 'Accept an offered XR session (equivalent to clicking "Enter XR" button)',
|
|
59
|
+
inputSchema: {
|
|
60
|
+
type: 'object',
|
|
61
|
+
properties: {},
|
|
62
|
+
required: [],
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'xr_end_session',
|
|
67
|
+
description: 'End the current active XR session',
|
|
68
|
+
inputSchema: {
|
|
69
|
+
type: 'object',
|
|
70
|
+
properties: {},
|
|
71
|
+
required: [],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
// =============================================================================
|
|
75
|
+
// Transform Control
|
|
76
|
+
// =============================================================================
|
|
77
|
+
{
|
|
78
|
+
name: 'xr_get_transform',
|
|
79
|
+
description: 'Get position and orientation of a tracked device',
|
|
80
|
+
inputSchema: {
|
|
81
|
+
type: 'object',
|
|
82
|
+
properties: {
|
|
83
|
+
device: {
|
|
84
|
+
type: 'string',
|
|
85
|
+
enum: [
|
|
86
|
+
'headset',
|
|
87
|
+
'controller-left',
|
|
88
|
+
'controller-right',
|
|
89
|
+
'hand-left',
|
|
90
|
+
'hand-right',
|
|
91
|
+
],
|
|
92
|
+
description: 'The device to query',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
required: ['device'],
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: 'xr_set_transform',
|
|
100
|
+
description: 'Set position and/or orientation of a tracked device. Position is in meters, orientation can be quaternion or euler angles (degrees).',
|
|
101
|
+
inputSchema: {
|
|
102
|
+
type: 'object',
|
|
103
|
+
properties: {
|
|
104
|
+
device: {
|
|
105
|
+
type: 'string',
|
|
106
|
+
enum: [
|
|
107
|
+
'headset',
|
|
108
|
+
'controller-left',
|
|
109
|
+
'controller-right',
|
|
110
|
+
'hand-left',
|
|
111
|
+
'hand-right',
|
|
112
|
+
],
|
|
113
|
+
description: 'The device to move',
|
|
114
|
+
},
|
|
115
|
+
position: {
|
|
116
|
+
type: 'object',
|
|
117
|
+
description: 'World position in meters',
|
|
118
|
+
properties: {
|
|
119
|
+
x: { type: 'number', description: 'X position (left/right)' },
|
|
120
|
+
y: {
|
|
121
|
+
type: 'number',
|
|
122
|
+
description: 'Y position (up/down, 1.6 is standing height)',
|
|
123
|
+
},
|
|
124
|
+
z: {
|
|
125
|
+
type: 'number',
|
|
126
|
+
description: 'Z position (forward/back, negative is forward)',
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
orientation: {
|
|
131
|
+
type: 'object',
|
|
132
|
+
description: 'Rotation as quaternion {x,y,z,w} or euler angles {pitch,yaw,roll} in degrees',
|
|
133
|
+
properties: {
|
|
134
|
+
x: { type: 'number', description: 'Quaternion X component' },
|
|
135
|
+
y: { type: 'number', description: 'Quaternion Y component' },
|
|
136
|
+
z: { type: 'number', description: 'Quaternion Z component' },
|
|
137
|
+
w: { type: 'number', description: 'Quaternion W component' },
|
|
138
|
+
pitch: {
|
|
139
|
+
type: 'number',
|
|
140
|
+
description: 'Pitch in degrees (X rotation)',
|
|
141
|
+
},
|
|
142
|
+
yaw: { type: 'number', description: 'Yaw in degrees (Y rotation)' },
|
|
143
|
+
roll: {
|
|
144
|
+
type: 'number',
|
|
145
|
+
description: 'Roll in degrees (Z rotation)',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
required: ['device'],
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: 'xr_look_at',
|
|
155
|
+
description: 'Orient a device to look at a specific world position',
|
|
156
|
+
inputSchema: {
|
|
157
|
+
type: 'object',
|
|
158
|
+
properties: {
|
|
159
|
+
device: {
|
|
160
|
+
type: 'string',
|
|
161
|
+
enum: [
|
|
162
|
+
'headset',
|
|
163
|
+
'controller-left',
|
|
164
|
+
'controller-right',
|
|
165
|
+
'hand-left',
|
|
166
|
+
'hand-right',
|
|
167
|
+
],
|
|
168
|
+
description: 'The device to orient',
|
|
169
|
+
},
|
|
170
|
+
target: {
|
|
171
|
+
type: 'object',
|
|
172
|
+
description: 'World position to look at',
|
|
173
|
+
properties: {
|
|
174
|
+
x: { type: 'number' },
|
|
175
|
+
y: { type: 'number' },
|
|
176
|
+
z: { type: 'number' },
|
|
177
|
+
},
|
|
178
|
+
required: ['x', 'y', 'z'],
|
|
179
|
+
},
|
|
180
|
+
moveToDistance: {
|
|
181
|
+
type: 'number',
|
|
182
|
+
description: 'Optional: move device to this distance from target',
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
required: ['device', 'target'],
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: 'xr_animate_to',
|
|
190
|
+
description: 'Smoothly animate a device to a new position/orientation over time',
|
|
191
|
+
inputSchema: {
|
|
192
|
+
type: 'object',
|
|
193
|
+
properties: {
|
|
194
|
+
device: {
|
|
195
|
+
type: 'string',
|
|
196
|
+
enum: [
|
|
197
|
+
'headset',
|
|
198
|
+
'controller-left',
|
|
199
|
+
'controller-right',
|
|
200
|
+
'hand-left',
|
|
201
|
+
'hand-right',
|
|
202
|
+
],
|
|
203
|
+
description: 'The device to animate',
|
|
204
|
+
},
|
|
205
|
+
position: {
|
|
206
|
+
type: 'object',
|
|
207
|
+
description: 'Target world position in meters',
|
|
208
|
+
properties: {
|
|
209
|
+
x: { type: 'number' },
|
|
210
|
+
y: { type: 'number' },
|
|
211
|
+
z: { type: 'number' },
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
orientation: {
|
|
215
|
+
type: 'object',
|
|
216
|
+
description: 'Target rotation as quaternion {x,y,z,w} or euler angles {pitch,yaw,roll} in degrees',
|
|
217
|
+
properties: {
|
|
218
|
+
x: { type: 'number', description: 'Quaternion X component' },
|
|
219
|
+
y: { type: 'number', description: 'Quaternion Y component' },
|
|
220
|
+
z: { type: 'number', description: 'Quaternion Z component' },
|
|
221
|
+
w: { type: 'number', description: 'Quaternion W component' },
|
|
222
|
+
pitch: {
|
|
223
|
+
type: 'number',
|
|
224
|
+
description: 'Pitch in degrees (X rotation)',
|
|
225
|
+
},
|
|
226
|
+
yaw: { type: 'number', description: 'Yaw in degrees (Y rotation)' },
|
|
227
|
+
roll: {
|
|
228
|
+
type: 'number',
|
|
229
|
+
description: 'Roll in degrees (Z rotation)',
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
duration: {
|
|
234
|
+
type: 'number',
|
|
235
|
+
description: 'Animation duration in seconds (default: 0.5)',
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
required: ['device'],
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
// =============================================================================
|
|
242
|
+
// Input Mode
|
|
243
|
+
// =============================================================================
|
|
244
|
+
{
|
|
245
|
+
name: 'xr_set_input_mode',
|
|
246
|
+
description: 'Switch between controller and hand tracking input modes',
|
|
247
|
+
inputSchema: {
|
|
248
|
+
type: 'object',
|
|
249
|
+
properties: {
|
|
250
|
+
mode: {
|
|
251
|
+
type: 'string',
|
|
252
|
+
enum: ['controller', 'hand'],
|
|
253
|
+
description: 'Input mode to switch to',
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
required: ['mode'],
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
name: 'xr_set_connected',
|
|
261
|
+
description: 'Connect or disconnect an input device',
|
|
262
|
+
inputSchema: {
|
|
263
|
+
type: 'object',
|
|
264
|
+
properties: {
|
|
265
|
+
device: {
|
|
266
|
+
type: 'string',
|
|
267
|
+
enum: [
|
|
268
|
+
'controller-left',
|
|
269
|
+
'controller-right',
|
|
270
|
+
'hand-left',
|
|
271
|
+
'hand-right',
|
|
272
|
+
],
|
|
273
|
+
description: 'The input device',
|
|
274
|
+
},
|
|
275
|
+
connected: {
|
|
276
|
+
type: 'boolean',
|
|
277
|
+
description: 'Whether the device should be connected',
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
required: ['device', 'connected'],
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
// =============================================================================
|
|
284
|
+
// Select/Trigger Input
|
|
285
|
+
// =============================================================================
|
|
286
|
+
{
|
|
287
|
+
name: 'xr_get_select_value',
|
|
288
|
+
description: 'Get the current select (trigger/pinch) value for an input device',
|
|
289
|
+
inputSchema: {
|
|
290
|
+
type: 'object',
|
|
291
|
+
properties: {
|
|
292
|
+
device: {
|
|
293
|
+
type: 'string',
|
|
294
|
+
enum: [
|
|
295
|
+
'controller-left',
|
|
296
|
+
'controller-right',
|
|
297
|
+
'hand-left',
|
|
298
|
+
'hand-right',
|
|
299
|
+
],
|
|
300
|
+
description: 'The input device',
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
required: ['device'],
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
name: 'xr_set_select_value',
|
|
308
|
+
description: 'Set the select (trigger/pinch) value for an input device. Use for grab-move-release patterns.',
|
|
309
|
+
inputSchema: {
|
|
310
|
+
type: 'object',
|
|
311
|
+
properties: {
|
|
312
|
+
device: {
|
|
313
|
+
type: 'string',
|
|
314
|
+
enum: [
|
|
315
|
+
'controller-left',
|
|
316
|
+
'controller-right',
|
|
317
|
+
'hand-left',
|
|
318
|
+
'hand-right',
|
|
319
|
+
],
|
|
320
|
+
description: 'The input device',
|
|
321
|
+
},
|
|
322
|
+
value: {
|
|
323
|
+
type: 'number',
|
|
324
|
+
minimum: 0,
|
|
325
|
+
maximum: 1,
|
|
326
|
+
description: 'Select value (0=released, 1=fully pressed/pinched)',
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
required: ['device', 'value'],
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
name: 'xr_select',
|
|
334
|
+
description: 'Perform a complete select action (press and release). Dispatches selectstart, select, selectend events.',
|
|
335
|
+
inputSchema: {
|
|
336
|
+
type: 'object',
|
|
337
|
+
properties: {
|
|
338
|
+
device: {
|
|
339
|
+
type: 'string',
|
|
340
|
+
enum: [
|
|
341
|
+
'controller-left',
|
|
342
|
+
'controller-right',
|
|
343
|
+
'hand-left',
|
|
344
|
+
'hand-right',
|
|
345
|
+
],
|
|
346
|
+
description: 'The input device',
|
|
347
|
+
},
|
|
348
|
+
duration: {
|
|
349
|
+
type: 'number',
|
|
350
|
+
description: 'How long to hold in seconds (default: 0.15)',
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
required: ['device'],
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
// =============================================================================
|
|
357
|
+
// Gamepad State (Controllers only)
|
|
358
|
+
// =============================================================================
|
|
359
|
+
{
|
|
360
|
+
name: 'xr_get_gamepad_state',
|
|
361
|
+
description: 'Get full gamepad state including all buttons and axes. Button indices in the result: 0=trigger, 1=squeeze, 2=thumbstick, 3=A/X, 4=B/Y, 5=thumbrest.',
|
|
362
|
+
inputSchema: {
|
|
363
|
+
type: 'object',
|
|
364
|
+
properties: {
|
|
365
|
+
device: {
|
|
366
|
+
type: 'string',
|
|
367
|
+
enum: ['controller-left', 'controller-right'],
|
|
368
|
+
description: 'The controller',
|
|
369
|
+
},
|
|
370
|
+
},
|
|
371
|
+
required: ['device'],
|
|
372
|
+
},
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
name: 'xr_set_gamepad_state',
|
|
376
|
+
description: 'Set gamepad button and axis values by index',
|
|
377
|
+
inputSchema: {
|
|
378
|
+
type: 'object',
|
|
379
|
+
properties: {
|
|
380
|
+
device: {
|
|
381
|
+
type: 'string',
|
|
382
|
+
enum: ['controller-left', 'controller-right'],
|
|
383
|
+
description: 'The controller',
|
|
384
|
+
},
|
|
385
|
+
buttons: {
|
|
386
|
+
type: 'array',
|
|
387
|
+
description: 'Button states to set',
|
|
388
|
+
items: {
|
|
389
|
+
type: 'object',
|
|
390
|
+
properties: {
|
|
391
|
+
index: {
|
|
392
|
+
type: 'number',
|
|
393
|
+
description: 'Button index (0=trigger, 1=squeeze, 2=thumbstick, 3=A/X, 4=B/Y, 5=thumbrest)',
|
|
394
|
+
},
|
|
395
|
+
value: { type: 'number', description: 'Button value 0-1' },
|
|
396
|
+
touched: {
|
|
397
|
+
type: 'boolean',
|
|
398
|
+
description: 'Whether button is touched',
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
required: ['index', 'value'],
|
|
402
|
+
},
|
|
403
|
+
},
|
|
404
|
+
axes: {
|
|
405
|
+
type: 'array',
|
|
406
|
+
description: 'Axis values to set',
|
|
407
|
+
items: {
|
|
408
|
+
type: 'object',
|
|
409
|
+
properties: {
|
|
410
|
+
index: {
|
|
411
|
+
type: 'number',
|
|
412
|
+
description: 'Axis index (0=thumbstick X, 1=thumbstick Y)',
|
|
413
|
+
},
|
|
414
|
+
value: { type: 'number', description: 'Axis value -1 to 1' },
|
|
415
|
+
},
|
|
416
|
+
required: ['index', 'value'],
|
|
417
|
+
},
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
required: ['device'],
|
|
421
|
+
},
|
|
422
|
+
},
|
|
423
|
+
// =============================================================================
|
|
424
|
+
// Screenshot
|
|
425
|
+
// =============================================================================
|
|
426
|
+
{
|
|
427
|
+
name: 'browser_screenshot',
|
|
428
|
+
description: 'Capture a screenshot of the browser. Returns the image directly.',
|
|
429
|
+
inputSchema: {
|
|
430
|
+
type: 'object',
|
|
431
|
+
properties: {},
|
|
432
|
+
},
|
|
433
|
+
},
|
|
434
|
+
// =============================================================================
|
|
435
|
+
// Device State
|
|
436
|
+
// =============================================================================
|
|
437
|
+
{
|
|
438
|
+
name: 'xr_get_device_state',
|
|
439
|
+
description: 'Get comprehensive state of the XR device including headset, controllers, and hands',
|
|
440
|
+
inputSchema: {
|
|
441
|
+
type: 'object',
|
|
442
|
+
properties: {},
|
|
443
|
+
required: [],
|
|
444
|
+
},
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
name: 'xr_set_device_state',
|
|
448
|
+
description: 'Set device state. When called with no state, resets everything to defaults.',
|
|
449
|
+
inputSchema: {
|
|
450
|
+
type: 'object',
|
|
451
|
+
properties: {
|
|
452
|
+
state: {
|
|
453
|
+
type: 'object',
|
|
454
|
+
description: 'Partial device state to apply. Omit to reset to defaults.',
|
|
455
|
+
properties: {
|
|
456
|
+
headset: {
|
|
457
|
+
type: 'object',
|
|
458
|
+
description: 'Headset transform',
|
|
459
|
+
properties: {
|
|
460
|
+
position: {
|
|
461
|
+
type: 'object',
|
|
462
|
+
properties: {
|
|
463
|
+
x: { type: 'number' },
|
|
464
|
+
y: { type: 'number' },
|
|
465
|
+
z: { type: 'number' },
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
orientation: {
|
|
469
|
+
type: 'object',
|
|
470
|
+
properties: {
|
|
471
|
+
x: { type: 'number' },
|
|
472
|
+
y: { type: 'number' },
|
|
473
|
+
z: { type: 'number' },
|
|
474
|
+
w: { type: 'number' },
|
|
475
|
+
},
|
|
476
|
+
},
|
|
477
|
+
},
|
|
478
|
+
},
|
|
479
|
+
inputMode: {
|
|
480
|
+
type: 'string',
|
|
481
|
+
enum: ['controller', 'hand'],
|
|
482
|
+
description: 'Input mode',
|
|
483
|
+
},
|
|
484
|
+
stereoEnabled: {
|
|
485
|
+
type: 'boolean',
|
|
486
|
+
description: 'Whether stereo rendering is enabled',
|
|
487
|
+
},
|
|
488
|
+
fov: {
|
|
489
|
+
type: 'number',
|
|
490
|
+
description: 'Field of view in degrees',
|
|
491
|
+
},
|
|
492
|
+
controllers: {
|
|
493
|
+
type: 'object',
|
|
494
|
+
description: 'Controller states',
|
|
495
|
+
properties: {
|
|
496
|
+
left: {
|
|
497
|
+
type: 'object',
|
|
498
|
+
properties: {
|
|
499
|
+
position: { type: 'object' },
|
|
500
|
+
orientation: { type: 'object' },
|
|
501
|
+
connected: { type: 'boolean' },
|
|
502
|
+
},
|
|
503
|
+
},
|
|
504
|
+
right: {
|
|
505
|
+
type: 'object',
|
|
506
|
+
properties: {
|
|
507
|
+
position: { type: 'object' },
|
|
508
|
+
orientation: { type: 'object' },
|
|
509
|
+
connected: { type: 'boolean' },
|
|
510
|
+
},
|
|
511
|
+
},
|
|
512
|
+
},
|
|
513
|
+
},
|
|
514
|
+
hands: {
|
|
515
|
+
type: 'object',
|
|
516
|
+
description: 'Hand states',
|
|
517
|
+
properties: {
|
|
518
|
+
left: {
|
|
519
|
+
type: 'object',
|
|
520
|
+
properties: {
|
|
521
|
+
position: { type: 'object' },
|
|
522
|
+
orientation: { type: 'object' },
|
|
523
|
+
connected: { type: 'boolean' },
|
|
524
|
+
},
|
|
525
|
+
},
|
|
526
|
+
right: {
|
|
527
|
+
type: 'object',
|
|
528
|
+
properties: {
|
|
529
|
+
position: { type: 'object' },
|
|
530
|
+
orientation: { type: 'object' },
|
|
531
|
+
connected: { type: 'boolean' },
|
|
532
|
+
},
|
|
533
|
+
},
|
|
534
|
+
},
|
|
535
|
+
},
|
|
536
|
+
},
|
|
537
|
+
},
|
|
538
|
+
},
|
|
539
|
+
},
|
|
540
|
+
},
|
|
541
|
+
// =============================================================================
|
|
542
|
+
// Console Logs (Plugin-specific, not in IWER)
|
|
543
|
+
// =============================================================================
|
|
544
|
+
{
|
|
545
|
+
name: 'browser_get_console_logs',
|
|
546
|
+
description: 'Get console logs from the browser with optional filtering. By default excludes debug level logs.',
|
|
547
|
+
inputSchema: {
|
|
548
|
+
type: 'object',
|
|
549
|
+
properties: {
|
|
550
|
+
count: {
|
|
551
|
+
type: 'number',
|
|
552
|
+
description: 'Maximum number of logs to return (most recent N)',
|
|
553
|
+
},
|
|
554
|
+
level: {
|
|
555
|
+
oneOf: [
|
|
556
|
+
{
|
|
557
|
+
type: 'string',
|
|
558
|
+
enum: ['log', 'info', 'warn', 'error', 'debug'],
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
type: 'array',
|
|
562
|
+
items: {
|
|
563
|
+
type: 'string',
|
|
564
|
+
enum: ['log', 'info', 'warn', 'error', 'debug'],
|
|
565
|
+
},
|
|
566
|
+
},
|
|
567
|
+
],
|
|
568
|
+
description: 'Filter by log level(s). Default: ["log", "info", "warn", "error"] (excludes debug)',
|
|
569
|
+
},
|
|
570
|
+
pattern: {
|
|
571
|
+
type: 'string',
|
|
572
|
+
description: 'Regex pattern to filter log messages',
|
|
573
|
+
},
|
|
574
|
+
since: {
|
|
575
|
+
type: 'number',
|
|
576
|
+
description: 'Return logs since this timestamp (ms since epoch)',
|
|
577
|
+
},
|
|
578
|
+
},
|
|
579
|
+
},
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
name: 'browser_reload_page',
|
|
583
|
+
description: 'Reload the browser page to reset application state. Use when the app enters an unrecoverable state or to apply code changes.',
|
|
584
|
+
inputSchema: {
|
|
585
|
+
type: 'object',
|
|
586
|
+
properties: {},
|
|
587
|
+
},
|
|
588
|
+
},
|
|
589
|
+
// =============================================================================
|
|
590
|
+
// Framework-Specific Tools (IWSDK or any framework with FRAMEWORK_MCP_RUNTIME)
|
|
591
|
+
// =============================================================================
|
|
592
|
+
{
|
|
593
|
+
name: 'scene_get_hierarchy',
|
|
594
|
+
description: 'Get the Three.js scene hierarchy as a JSON tree. Returns object names, UUIDs, and entity indices where available. Requires IWSDK or a framework that provides FRAMEWORK_MCP_RUNTIME.',
|
|
595
|
+
inputSchema: {
|
|
596
|
+
type: 'object',
|
|
597
|
+
properties: {
|
|
598
|
+
parentId: {
|
|
599
|
+
type: 'string',
|
|
600
|
+
description: 'UUID of parent Object3D to start from. Defaults to scene root if omitted.',
|
|
601
|
+
},
|
|
602
|
+
maxDepth: {
|
|
603
|
+
type: 'number',
|
|
604
|
+
description: 'Maximum depth to traverse (default: 5). Use to limit context size.',
|
|
605
|
+
},
|
|
606
|
+
},
|
|
607
|
+
},
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
name: 'scene_get_object_transform',
|
|
611
|
+
description: 'Get local and global transforms of an Object3D. Includes positionRelativeToXROrigin which can be used directly with xr_look_at tool. Requires IWSDK or a framework that provides FRAMEWORK_MCP_RUNTIME.',
|
|
612
|
+
inputSchema: {
|
|
613
|
+
type: 'object',
|
|
614
|
+
properties: {
|
|
615
|
+
uuid: {
|
|
616
|
+
type: 'string',
|
|
617
|
+
description: 'UUID of the Object3D (get this from scene_get_hierarchy)',
|
|
618
|
+
},
|
|
619
|
+
},
|
|
620
|
+
required: ['uuid'],
|
|
621
|
+
},
|
|
622
|
+
},
|
|
623
|
+
// =============================================================================
|
|
624
|
+
// ECS Debugging (IWSDK — requires FRAMEWORK_MCP_RUNTIME)
|
|
625
|
+
// =============================================================================
|
|
626
|
+
{
|
|
627
|
+
name: 'ecs_pause',
|
|
628
|
+
description: 'Pause ECS system updates. The render loop continues (XR session stays alive, screenshots still work) but no systems tick. Use ecs_step to advance individual frames while paused. Requires FRAMEWORK_MCP_RUNTIME.',
|
|
629
|
+
inputSchema: {
|
|
630
|
+
type: 'object',
|
|
631
|
+
properties: {},
|
|
632
|
+
},
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
name: 'ecs_resume',
|
|
636
|
+
description: 'Resume ECS system updates after pausing. The first frame after resume uses a capped delta to avoid physics explosions. Requires FRAMEWORK_MCP_RUNTIME.',
|
|
637
|
+
inputSchema: {
|
|
638
|
+
type: 'object',
|
|
639
|
+
properties: {},
|
|
640
|
+
},
|
|
641
|
+
},
|
|
642
|
+
{
|
|
643
|
+
name: 'ecs_step',
|
|
644
|
+
description: 'Advance N ECS frames with a fixed timestep while paused. Must call ecs_pause first. Useful for frame-by-frame debugging. Requires FRAMEWORK_MCP_RUNTIME.',
|
|
645
|
+
inputSchema: {
|
|
646
|
+
type: 'object',
|
|
647
|
+
properties: {
|
|
648
|
+
count: {
|
|
649
|
+
type: 'number',
|
|
650
|
+
description: 'Number of frames to advance (1-120, default: 1)',
|
|
651
|
+
},
|
|
652
|
+
delta: {
|
|
653
|
+
type: 'number',
|
|
654
|
+
description: 'Fixed timestep in seconds for each frame (default: 1/72 ≈ 0.0139, matching Quest refresh rate)',
|
|
655
|
+
},
|
|
656
|
+
},
|
|
657
|
+
},
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
name: 'ecs_query_entity',
|
|
661
|
+
description: 'Get all component data for an entity. Use entityIndex from scene_get_hierarchy or ecs_find_entities. Returns serialized component values including vectors, entity refs, and Object3D references. Requires FRAMEWORK_MCP_RUNTIME.',
|
|
662
|
+
inputSchema: {
|
|
663
|
+
type: 'object',
|
|
664
|
+
properties: {
|
|
665
|
+
entityIndex: {
|
|
666
|
+
type: 'number',
|
|
667
|
+
description: 'Entity index (get this from scene_get_hierarchy or ecs_find_entities)',
|
|
668
|
+
},
|
|
669
|
+
components: {
|
|
670
|
+
type: 'array',
|
|
671
|
+
items: { type: 'string' },
|
|
672
|
+
description: 'Optional list of component IDs to include. If omitted, returns all components on the entity.',
|
|
673
|
+
},
|
|
674
|
+
},
|
|
675
|
+
required: ['entityIndex'],
|
|
676
|
+
},
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
name: 'ecs_find_entities',
|
|
680
|
+
description: 'Find entities by component composition and/or name. Returns entity indices and component lists. Use the returned entityIndex values with ecs_query_entity for detailed inspection. Requires FRAMEWORK_MCP_RUNTIME.',
|
|
681
|
+
inputSchema: {
|
|
682
|
+
type: 'object',
|
|
683
|
+
properties: {
|
|
684
|
+
withComponents: {
|
|
685
|
+
type: 'array',
|
|
686
|
+
items: { type: 'string' },
|
|
687
|
+
description: 'Component IDs that entities must have (AND logic)',
|
|
688
|
+
},
|
|
689
|
+
withoutComponents: {
|
|
690
|
+
type: 'array',
|
|
691
|
+
items: { type: 'string' },
|
|
692
|
+
description: 'Component IDs that entities must NOT have',
|
|
693
|
+
},
|
|
694
|
+
namePattern: {
|
|
695
|
+
type: 'string',
|
|
696
|
+
description: 'Regex pattern to match against entity Object3D name (case-insensitive)',
|
|
697
|
+
},
|
|
698
|
+
limit: {
|
|
699
|
+
type: 'number',
|
|
700
|
+
description: 'Maximum number of results (1-50, default: 50)',
|
|
701
|
+
},
|
|
702
|
+
},
|
|
703
|
+
},
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
name: 'ecs_list_systems',
|
|
707
|
+
description: 'List all registered ECS systems with name, priority, pause state, config keys, and query entity counts. Requires FRAMEWORK_MCP_RUNTIME.',
|
|
708
|
+
inputSchema: {
|
|
709
|
+
type: 'object',
|
|
710
|
+
properties: {},
|
|
711
|
+
},
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
name: 'ecs_list_components',
|
|
715
|
+
description: 'List all registered ECS components with their field schemas (type, default). Requires FRAMEWORK_MCP_RUNTIME.',
|
|
716
|
+
inputSchema: {
|
|
717
|
+
type: 'object',
|
|
718
|
+
properties: {},
|
|
719
|
+
},
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
name: 'ecs_toggle_system',
|
|
723
|
+
description: 'Pause or resume a specific ECS system by name. Use ecs_list_systems to discover system names. Requires FRAMEWORK_MCP_RUNTIME.',
|
|
724
|
+
inputSchema: {
|
|
725
|
+
type: 'object',
|
|
726
|
+
properties: {
|
|
727
|
+
name: {
|
|
728
|
+
type: 'string',
|
|
729
|
+
description: "System class name (e.g. 'OrbSystem', 'RobotSystem')",
|
|
730
|
+
},
|
|
731
|
+
paused: {
|
|
732
|
+
type: 'boolean',
|
|
733
|
+
description: 'Set to true to pause, false to resume. If omitted, toggles current state.',
|
|
734
|
+
},
|
|
735
|
+
},
|
|
736
|
+
required: ['name'],
|
|
737
|
+
},
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
name: 'ecs_set_component',
|
|
741
|
+
description: 'Set a component field value on an entity. Scalars use setValue (with validation), vectors accept arrays. Use ecs_query_entity to inspect current values first. Requires FRAMEWORK_MCP_RUNTIME.',
|
|
742
|
+
inputSchema: {
|
|
743
|
+
type: 'object',
|
|
744
|
+
properties: {
|
|
745
|
+
entityIndex: {
|
|
746
|
+
type: 'number',
|
|
747
|
+
description: 'Entity index (from ecs_find_entities or scene_get_hierarchy)',
|
|
748
|
+
},
|
|
749
|
+
componentId: {
|
|
750
|
+
type: 'string',
|
|
751
|
+
description: "Component ID (e.g. 'Orb', 'RobotMood', 'Transform')",
|
|
752
|
+
},
|
|
753
|
+
field: {
|
|
754
|
+
type: 'string',
|
|
755
|
+
description: "Field name within the component (e.g. 'orbitSpeed', 'mood')",
|
|
756
|
+
},
|
|
757
|
+
value: {
|
|
758
|
+
description: 'New value. Scalars: number/string/boolean. Vectors: array of numbers (e.g. [1,2,3] for Vec3).',
|
|
759
|
+
},
|
|
760
|
+
},
|
|
761
|
+
required: ['entityIndex', 'componentId', 'field', 'value'],
|
|
762
|
+
},
|
|
763
|
+
},
|
|
764
|
+
{
|
|
765
|
+
name: 'ecs_snapshot',
|
|
766
|
+
description: 'Capture a snapshot of all ECS entity/component state. Stores up to 2 snapshots. Use with ecs_diff to compare. Requires FRAMEWORK_MCP_RUNTIME.',
|
|
767
|
+
inputSchema: {
|
|
768
|
+
type: 'object',
|
|
769
|
+
properties: {
|
|
770
|
+
label: {
|
|
771
|
+
type: 'string',
|
|
772
|
+
description: 'Label for this snapshot (default: auto-generated). Use to reference in ecs_diff.',
|
|
773
|
+
},
|
|
774
|
+
},
|
|
775
|
+
},
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
name: 'ecs_diff',
|
|
779
|
+
description: 'Compare two ECS snapshots. Shows added/removed/changed entities and field-level diffs. Requires FRAMEWORK_MCP_RUNTIME.',
|
|
780
|
+
inputSchema: {
|
|
781
|
+
type: 'object',
|
|
782
|
+
properties: {
|
|
783
|
+
from: {
|
|
784
|
+
type: 'string',
|
|
785
|
+
description: "Label of the 'before' snapshot",
|
|
786
|
+
},
|
|
787
|
+
to: {
|
|
788
|
+
type: 'string',
|
|
789
|
+
description: "Label of the 'after' snapshot",
|
|
790
|
+
},
|
|
791
|
+
},
|
|
792
|
+
required: ['from', 'to'],
|
|
793
|
+
},
|
|
794
|
+
},
|
|
795
|
+
];
|
|
796
|
+
const RUNTIME_TOOL_TO_METHOD = {
|
|
797
|
+
xr_get_session_status: 'get_session_status',
|
|
798
|
+
xr_accept_session: 'accept_session',
|
|
799
|
+
xr_end_session: 'end_session',
|
|
800
|
+
xr_get_transform: 'get_transform',
|
|
801
|
+
xr_set_transform: 'set_transform',
|
|
802
|
+
xr_look_at: 'look_at',
|
|
803
|
+
xr_animate_to: 'animate_to',
|
|
804
|
+
xr_set_input_mode: 'set_input_mode',
|
|
805
|
+
xr_set_connected: 'set_connected',
|
|
806
|
+
xr_get_select_value: 'get_select_value',
|
|
807
|
+
xr_set_select_value: 'set_select_value',
|
|
808
|
+
xr_select: 'select',
|
|
809
|
+
xr_get_gamepad_state: 'get_gamepad_state',
|
|
810
|
+
xr_set_gamepad_state: 'set_gamepad_state',
|
|
811
|
+
xr_get_device_state: 'get_device_state',
|
|
812
|
+
xr_set_device_state: 'set_device_state',
|
|
813
|
+
browser_screenshot: 'screenshot',
|
|
814
|
+
browser_get_console_logs: 'get_console_logs',
|
|
815
|
+
browser_reload_page: 'reload_page',
|
|
816
|
+
scene_get_hierarchy: 'get_scene_hierarchy',
|
|
817
|
+
scene_get_object_transform: 'get_object_transform',
|
|
818
|
+
};
|
|
819
|
+
const RUNTIME_CLI_PATHS = {
|
|
820
|
+
xr_get_session_status: ['xr', 'status'],
|
|
821
|
+
xr_accept_session: ['xr', 'enter'],
|
|
822
|
+
xr_end_session: ['xr', 'exit'],
|
|
823
|
+
xr_get_transform: ['xr', 'get-transform'],
|
|
824
|
+
xr_set_transform: ['xr', 'set-transform'],
|
|
825
|
+
xr_look_at: ['xr', 'look-at'],
|
|
826
|
+
xr_animate_to: ['xr', 'animate-to'],
|
|
827
|
+
xr_set_input_mode: ['xr', 'set-input-mode'],
|
|
828
|
+
xr_set_connected: ['xr', 'set-connected'],
|
|
829
|
+
xr_get_select_value: ['xr', 'get-select-value'],
|
|
830
|
+
xr_set_select_value: ['xr', 'set-select-value'],
|
|
831
|
+
xr_select: ['xr', 'select'],
|
|
832
|
+
xr_get_gamepad_state: ['xr', 'get-gamepad-state'],
|
|
833
|
+
xr_set_gamepad_state: ['xr', 'set-gamepad-state'],
|
|
834
|
+
browser_screenshot: ['browser', 'screenshot'],
|
|
835
|
+
xr_get_device_state: ['xr', 'get-device-state'],
|
|
836
|
+
xr_set_device_state: ['xr', 'set-device-state'],
|
|
837
|
+
browser_get_console_logs: ['browser', 'logs'],
|
|
838
|
+
browser_reload_page: ['browser', 'reload'],
|
|
839
|
+
scene_get_hierarchy: ['scene', 'hierarchy'],
|
|
840
|
+
scene_get_object_transform: ['scene', 'transform'],
|
|
841
|
+
ecs_pause: ['ecs', 'pause'],
|
|
842
|
+
ecs_resume: ['ecs', 'resume'],
|
|
843
|
+
ecs_step: ['ecs', 'step'],
|
|
844
|
+
ecs_query_entity: ['ecs', 'query'],
|
|
845
|
+
ecs_find_entities: ['ecs', 'find'],
|
|
846
|
+
ecs_list_systems: ['ecs', 'systems'],
|
|
847
|
+
ecs_list_components: ['ecs', 'components'],
|
|
848
|
+
ecs_toggle_system: ['ecs', 'toggle-system'],
|
|
849
|
+
ecs_set_component: ['ecs', 'set-component'],
|
|
850
|
+
ecs_snapshot: ['ecs', 'snapshot'],
|
|
851
|
+
ecs_diff: ['ecs', 'diff'],
|
|
852
|
+
};
|
|
853
|
+
const RUNTIME_OPERATIONS = RUNTIME_MCP_TOOLS.map((tool) => {
|
|
854
|
+
const cliPath = RUNTIME_CLI_PATHS[tool.name];
|
|
855
|
+
return {
|
|
856
|
+
id: cliPath ? cliPath.join('.') : tool.name,
|
|
857
|
+
domain: cliPath?.[0] ?? 'misc',
|
|
858
|
+
action: cliPath?.[1] ?? tool.name,
|
|
859
|
+
cliPath: cliPath ?? ['misc', tool.name],
|
|
860
|
+
mcpName: tool.name,
|
|
861
|
+
wsMethod: RUNTIME_TOOL_TO_METHOD[tool.name] ?? tool.name,
|
|
862
|
+
description: tool.description,
|
|
863
|
+
inputSchema: tool.inputSchema,
|
|
864
|
+
};
|
|
865
|
+
});
|
|
866
|
+
function getRuntimeOperationByToolName(toolName) {
|
|
867
|
+
return RUNTIME_OPERATIONS.find((operation) => operation.mcpName === toolName);
|
|
868
|
+
}
|
|
869
|
+
function getRuntimeOperationByCliPath(domain, action) {
|
|
870
|
+
return RUNTIME_OPERATIONS.find((operation) => operation.domain === domain && operation.action === action);
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
export { INTERNAL_BROWSER_PROBE_METHOD, IWSDK_PROJECT_STATE_DIR, IWSDK_RUNTIME_BROWSER_READY_SCHEMA_VERSION, IWSDK_RUNTIME_LAUNCH_PATH, IWSDK_RUNTIME_LOGS_DIR, IWSDK_RUNTIME_SESSION_PATH, IWSDK_RUNTIME_STATE_DIR, IWSDK_RUNTIME_STATE_SCHEMA_VERSION, MCP_CONFIG_TARGETS, RUNTIME_CLI_PATHS, RUNTIME_MCP_TOOLS, RUNTIME_OPERATIONS, RUNTIME_TOOL_TO_METHOD, SUPPORTED_AI_TOOLS, getRuntimeOperationByCliPath, getRuntimeOperationByToolName, hasRuntimeBrowserCommandReadyContract, isRuntimeBrowserCommandReady };
|
|
874
|
+
//# sourceMappingURL=contract.js.map
|