@iwsdk/vite-plugin-dev 0.3.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/LICENSE +21 -0
- package/README.md +153 -0
- package/dist/headless-browser.d.ts +43 -0
- package/dist/hzdb-telemetry.d.ts +23 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +1145 -0
- package/dist/index.js.map +1 -0
- package/dist/injection-bundle.js +598 -0
- package/dist/injection-bundler.d.ts +11 -0
- package/dist/injection-template.d.ts +7 -0
- package/dist/mcp/index.d.ts +7 -0
- package/dist/mcp/ws-client.d.ts +75 -0
- package/dist/mcp-relay.d.ts +38 -0
- package/dist/mcp-server.d.ts +1379 -0
- package/dist/mcp-server.js +21312 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/types.d.ts +142 -0
- package/package.json +57 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
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
|
+
/**
|
|
8
|
+
* Synthetic Environment Module configuration
|
|
9
|
+
* @deprecated Use `emulator.environment` instead
|
|
10
|
+
*/
|
|
11
|
+
export interface SEMOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Default scene to load
|
|
14
|
+
* @default 'living_room'
|
|
15
|
+
*/
|
|
16
|
+
defaultScene?: 'living_room' | 'meeting_room' | 'music_room' | 'office_large' | 'office_small';
|
|
17
|
+
}
|
|
18
|
+
export type AiTool = 'claude' | 'cursor' | 'copilot' | 'codex';
|
|
19
|
+
export type AiMode = 'agent' | 'oversight' | 'collaborate';
|
|
20
|
+
/**
|
|
21
|
+
* AI agent tooling configuration.
|
|
22
|
+
* Enables AI agent control of the emulated XR runtime via MCP + WebSocket.
|
|
23
|
+
*/
|
|
24
|
+
export interface AiOptions {
|
|
25
|
+
/**
|
|
26
|
+
* Usage mode:
|
|
27
|
+
* - `'agent'`: Headless Playwright, fixed viewport, no DevUI. Normal browser opens for the human.
|
|
28
|
+
* - `'oversight'`: Visible Playwright, freely resizable, no DevUI. Human watches the agent.
|
|
29
|
+
* - `'collaborate'`: Visible Playwright, freely resizable, DevUI on. Human and agent share the session.
|
|
30
|
+
* @default 'agent'
|
|
31
|
+
*/
|
|
32
|
+
mode?: AiMode;
|
|
33
|
+
/**
|
|
34
|
+
* Which AI tools to generate MCP config files for.
|
|
35
|
+
* @default ['claude']
|
|
36
|
+
*/
|
|
37
|
+
tools?: AiTool[];
|
|
38
|
+
/**
|
|
39
|
+
* Screenshot size constraint.
|
|
40
|
+
* - In agent mode: sets the Playwright viewport dimensions directly.
|
|
41
|
+
* - In oversight/collaborate: screenshots are downscaled to fit within
|
|
42
|
+
* this bounding box, preserving aspect ratio.
|
|
43
|
+
* @default { width: 800, height: 800 }
|
|
44
|
+
*/
|
|
45
|
+
screenshotSize?: {
|
|
46
|
+
width?: number;
|
|
47
|
+
height?: number;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* XR emulator configuration
|
|
52
|
+
*/
|
|
53
|
+
export interface EmulatorOptions {
|
|
54
|
+
/**
|
|
55
|
+
* XR device to emulate
|
|
56
|
+
* @default 'metaQuest3'
|
|
57
|
+
*/
|
|
58
|
+
device?: 'metaQuest2' | 'metaQuest3' | 'metaQuestPro' | 'oculusQuest1';
|
|
59
|
+
/**
|
|
60
|
+
* When to activate the WebXR emulation
|
|
61
|
+
* 'localhost' - only activate when running on localhost (127.0.0.1, localhost)
|
|
62
|
+
* 'always' - always activate the emulation
|
|
63
|
+
* RegExp - activate when hostname matches the provided regex pattern
|
|
64
|
+
* @default 'localhost'
|
|
65
|
+
*/
|
|
66
|
+
activation?: 'localhost' | 'always' | RegExp;
|
|
67
|
+
/**
|
|
68
|
+
* Synthetic environment to load in the emulator
|
|
69
|
+
* @default undefined (no environment)
|
|
70
|
+
*/
|
|
71
|
+
environment?: 'living_room' | 'meeting_room' | 'music_room' | 'office_large' | 'office_small';
|
|
72
|
+
/**
|
|
73
|
+
* Inject script during build phase (in addition to dev)
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
76
|
+
injectOnBuild?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* User-Agent exception pattern. If the UA matches this RegExp, the
|
|
79
|
+
* runtime will NOT be injected even if activation passes.
|
|
80
|
+
* Useful to avoid injecting on real XR browsers like OculusBrowser.
|
|
81
|
+
* @default /OculusBrowser/
|
|
82
|
+
*/
|
|
83
|
+
userAgentException?: RegExp;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Main plugin options interface
|
|
87
|
+
*/
|
|
88
|
+
export interface DevPluginOptions {
|
|
89
|
+
/**
|
|
90
|
+
* XR emulator configuration
|
|
91
|
+
*/
|
|
92
|
+
emulator?: EmulatorOptions;
|
|
93
|
+
/**
|
|
94
|
+
* AI agent tooling configuration.
|
|
95
|
+
* Enables AI agent control of the emulated XR runtime via MCP + WebSocket.
|
|
96
|
+
* Omit to disable AI features entirely (no Playwright, no MCP configs).
|
|
97
|
+
*/
|
|
98
|
+
ai?: AiOptions;
|
|
99
|
+
/**
|
|
100
|
+
* Enable verbose logging
|
|
101
|
+
* @default false
|
|
102
|
+
*/
|
|
103
|
+
verbose?: boolean;
|
|
104
|
+
}
|
|
105
|
+
/** @deprecated Use `DevPluginOptions` instead */
|
|
106
|
+
export type IWERPluginOptions = DevPluginOptions;
|
|
107
|
+
/**
|
|
108
|
+
* Internal processed options with all defaults applied
|
|
109
|
+
*/
|
|
110
|
+
export interface ProcessedDevOptions {
|
|
111
|
+
device: 'metaQuest2' | 'metaQuest3' | 'metaQuestPro' | 'oculusQuest1';
|
|
112
|
+
sem?: {
|
|
113
|
+
defaultScene: string;
|
|
114
|
+
};
|
|
115
|
+
ai?: {
|
|
116
|
+
mode: AiMode;
|
|
117
|
+
tools: AiTool[];
|
|
118
|
+
headless: boolean;
|
|
119
|
+
devUI: boolean;
|
|
120
|
+
viewport: {
|
|
121
|
+
width: number;
|
|
122
|
+
height: number;
|
|
123
|
+
} | null;
|
|
124
|
+
screenshotSize: {
|
|
125
|
+
width: number;
|
|
126
|
+
height: number;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
injectOnBuild: boolean;
|
|
130
|
+
activation: 'localhost' | 'always' | RegExp;
|
|
131
|
+
verbose: boolean;
|
|
132
|
+
userAgentException?: RegExp | string;
|
|
133
|
+
}
|
|
134
|
+
/** @deprecated Use `ProcessedDevOptions` instead */
|
|
135
|
+
export type ProcessedIWEROptions = ProcessedDevOptions;
|
|
136
|
+
/**
|
|
137
|
+
* Injection bundle result
|
|
138
|
+
*/
|
|
139
|
+
export interface InjectionBundleResult {
|
|
140
|
+
code: string;
|
|
141
|
+
size: number;
|
|
142
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@iwsdk/vite-plugin-dev",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Vite plugin for IWSDK development — XR emulation, AI agent tooling, and Playwright browser",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"iwsdk-dev-mcp": "./dist/mcp-server.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"vite",
|
|
17
|
+
"plugin",
|
|
18
|
+
"webxr",
|
|
19
|
+
"emulation",
|
|
20
|
+
"iwsdk",
|
|
21
|
+
"ai",
|
|
22
|
+
"polyfill",
|
|
23
|
+
"meta",
|
|
24
|
+
"quest",
|
|
25
|
+
"mcp"
|
|
26
|
+
],
|
|
27
|
+
"author": "Felix Zhang <fe1ix@meta.com>",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@iwer/devui": "^2.2.0",
|
|
31
|
+
"@iwer/sem": "^0.2.5",
|
|
32
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
33
|
+
"iwer": "^2.2.0",
|
|
34
|
+
"playwright": "^1.58.2",
|
|
35
|
+
"sharp": "^0.33.0",
|
|
36
|
+
"ws": "^8.18.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/ws": "^8.5.13",
|
|
40
|
+
"vitest": "^4.0.0"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"vite": "^7.0.0"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=20.19.0"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "rollup -c rollup.injection.config.js && rollup -c rollup.config.js",
|
|
50
|
+
"build:plugin": "rollup -c rollup.config.js",
|
|
51
|
+
"build:injection": "rollup -c rollup.injection.config.js",
|
|
52
|
+
"test": "vitest run",
|
|
53
|
+
"test:watch": "vitest",
|
|
54
|
+
"dev": "rollup -c --watch",
|
|
55
|
+
"clean": "rm -rf dist"
|
|
56
|
+
}
|
|
57
|
+
}
|