@elizaos/plugin-xr 2.0.3-beta.5 → 2.0.3-beta.7

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.
Files changed (83) hide show
  1. package/dist/actions/xr-query-vision.d.ts +3 -0
  2. package/dist/actions/xr-query-vision.d.ts.map +1 -0
  3. package/dist/actions/xr-query-vision.js +39 -0
  4. package/dist/actions/xr-query-vision.js.map +1 -0
  5. package/dist/actions/xr-view-actions.d.ts +18 -0
  6. package/dist/actions/xr-view-actions.d.ts.map +1 -0
  7. package/dist/actions/xr-view-actions.js +304 -0
  8. package/dist/actions/xr-view-actions.js.map +1 -0
  9. package/dist/index.d.ts +8 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +57 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/protocol.d.ts +124 -0
  14. package/dist/protocol.d.ts.map +1 -0
  15. package/dist/protocol.js +18 -0
  16. package/dist/protocol.js.map +1 -0
  17. package/dist/providers/xr-context.d.ts +3 -0
  18. package/dist/providers/xr-context.d.ts.map +1 -0
  19. package/dist/providers/xr-context.js +34 -0
  20. package/dist/providers/xr-context.js.map +1 -0
  21. package/dist/routes/xr-connect.d.ts +3 -0
  22. package/dist/routes/xr-connect.d.ts.map +1 -0
  23. package/{src/routes/xr-connect.ts → dist/routes/xr-connect.js} +12 -15
  24. package/dist/routes/xr-connect.js.map +1 -0
  25. package/dist/routes/xr-simulator-route.d.ts +8 -0
  26. package/dist/routes/xr-simulator-route.d.ts.map +1 -0
  27. package/{src/routes/xr-simulator-route.ts → dist/routes/xr-simulator-route.js} +10 -16
  28. package/dist/routes/xr-simulator-route.js.map +1 -0
  29. package/dist/routes/xr-status.d.ts +3 -0
  30. package/dist/routes/xr-status.d.ts.map +1 -0
  31. package/{src/routes/xr-status.ts → dist/routes/xr-status.js} +13 -15
  32. package/dist/routes/xr-status.js.map +1 -0
  33. package/dist/routes/xr-view-host.d.ts +24 -0
  34. package/dist/routes/xr-view-host.d.ts.map +1 -0
  35. package/{src/routes/xr-view-host.ts → dist/routes/xr-view-host.js} +22 -59
  36. package/dist/routes/xr-view-host.js.map +1 -0
  37. package/dist/routes/xr-views.d.ts +8 -0
  38. package/dist/routes/xr-views.d.ts.map +1 -0
  39. package/dist/routes/xr-views.js +31 -0
  40. package/dist/routes/xr-views.js.map +1 -0
  41. package/dist/services/audio-pipeline.d.ts +20 -0
  42. package/dist/services/audio-pipeline.d.ts.map +1 -0
  43. package/{src/services/audio-pipeline.ts → dist/services/audio-pipeline.js} +25 -58
  44. package/dist/services/audio-pipeline.js.map +1 -0
  45. package/dist/services/vision-pipeline.d.ts +16 -0
  46. package/dist/services/vision-pipeline.d.ts.map +1 -0
  47. package/dist/services/vision-pipeline.js +39 -0
  48. package/dist/services/vision-pipeline.js.map +1 -0
  49. package/dist/services/xr-session-service.d.ts +50 -0
  50. package/dist/services/xr-session-service.d.ts.map +1 -0
  51. package/{src/services/xr-session-service.ts → dist/services/xr-session-service.js} +85 -194
  52. package/dist/services/xr-session-service.js.map +1 -0
  53. package/package.json +9 -4
  54. package/AGENTS.md +0 -151
  55. package/CLAUDE.md +0 -151
  56. package/simulator/bun.lock +0 -159
  57. package/simulator/package.json +0 -28
  58. package/simulator/src/emulator.ts +0 -174
  59. package/simulator/src/mock-agent.ts +0 -233
  60. package/simulator/src/node.ts +0 -9
  61. package/simulator/src/playwright-fixture.ts +0 -169
  62. package/simulator/src/types.ts +0 -51
  63. package/simulator/tsconfig.json +0 -13
  64. package/simulator/vite.config.ts +0 -25
  65. package/src/__tests__/audio-pipeline.test.ts +0 -129
  66. package/src/__tests__/protocol.test.ts +0 -53
  67. package/src/__tests__/routes-e2e.test.ts +0 -276
  68. package/src/__tests__/vision-pipeline.test.ts +0 -73
  69. package/src/__tests__/xr-bundle-coverage.test.ts +0 -303
  70. package/src/__tests__/xr-feature-parity.test.ts +0 -524
  71. package/src/__tests__/xr-functional-parity.test.ts +0 -522
  72. package/src/__tests__/xr-view-host-http.test.ts +0 -239
  73. package/src/__tests__/xr-view-host.test.ts +0 -174
  74. package/src/actions/xr-query-vision.ts +0 -64
  75. package/src/actions/xr-view-actions.ts +0 -386
  76. package/src/index.ts +0 -55
  77. package/src/protocol.ts +0 -126
  78. package/src/providers/xr-context.ts +0 -49
  79. package/src/routes/xr-views.ts +0 -43
  80. package/src/services/vision-pipeline.ts +0 -57
  81. package/tsconfig.build.json +0 -9
  82. package/tsconfig.json +0 -30
  83. package/vitest.config.ts +0 -21
@@ -1,303 +0,0 @@
1
- /**
2
- * XR view bundle coverage — validates that every registered XR view plugin
3
- * has a built dist/views/bundle.js that is non-empty, valid JavaScript,
4
- * and exports the component named in the plugin manifest.
5
- *
6
- * This is the "real elizaOS plugin infrastructure" layer the simulator tests
7
- * cannot reach: it proves that the actual view content (the React component
8
- * that loads inside the XR shell) is built, present, and structurally sound.
9
- *
10
- * What is tested:
11
- * - bundle.js exists for all 18 source-buildable plugins
12
- * - bundle.js is non-empty and contains built view content
13
- * - bundle.js contains the componentExport name from the manifest
14
- * - bundle.js is valid JavaScript (no JSON or HTML accidentally written there)
15
- * - The plugin manifest and bundle agree on componentExport
16
- */
17
-
18
- import { existsSync, readFileSync, statSync } from "node:fs";
19
- import { dirname, resolve } from "node:path";
20
- import { fileURLToPath } from "node:url";
21
- import { describe, expect, it } from "vitest";
22
-
23
- const repoRoot = resolve(
24
- dirname(fileURLToPath(import.meta.url)),
25
- "../../../..",
26
- );
27
-
28
- function readFile(relPath: string): string {
29
- return readFileSync(resolve(repoRoot, relPath), "utf8");
30
- }
31
-
32
- function fileExists(relPath: string): boolean {
33
- return existsSync(resolve(repoRoot, relPath));
34
- }
35
-
36
- function fileSize(relPath: string): number {
37
- const p = resolve(repoRoot, relPath);
38
- if (!existsSync(p)) return 0;
39
- return statSync(p).size;
40
- }
41
-
42
- function bundlePathFor(pluginDir: string): string {
43
- return `${pluginDir}/dist/views/bundle.js`;
44
- }
45
-
46
- function missingBundlePaths(): string[] {
47
- return PLUGIN_BUNDLES.map(({ pluginDir }) => bundlePathFor(pluginDir)).filter(
48
- (bundlePath) => !fileExists(bundlePath),
49
- );
50
- }
51
-
52
- // Parses viewType/id/componentExport/bundlePath from plugin source
53
- function extractXrViews(
54
- source: string,
55
- ): Array<{ id: string; componentExport: string; bundlePath: string }> {
56
- const results: Array<{
57
- id: string;
58
- componentExport: string;
59
- bundlePath: string;
60
- }> = [];
61
- // Match view objects with viewType: "xr"
62
- const viewsStart = source.indexOf("views:");
63
- if (viewsStart === -1) return results;
64
- const arrayStart = source.indexOf("[", viewsStart);
65
- if (arrayStart === -1) return results;
66
- let depth = 0;
67
- let arrayEnd = -1;
68
- for (let i = arrayStart; i < source.length; i++) {
69
- if (source[i] === "[") depth++;
70
- if (source[i] === "]") depth--;
71
- if (depth === 0) {
72
- arrayEnd = i;
73
- break;
74
- }
75
- }
76
- if (arrayEnd === -1) return results;
77
- const body = source.slice(arrayStart + 1, arrayEnd);
78
- const objects: string[] = [];
79
- let start = -1;
80
- depth = 0;
81
- for (let i = 0; i < body.length; i++) {
82
- if (body[i] === "{") {
83
- if (depth === 0) start = i;
84
- depth++;
85
- }
86
- if (body[i] === "}") {
87
- depth--;
88
- if (depth === 0 && start !== -1) {
89
- objects.push(body.slice(start, i + 1));
90
- start = -1;
91
- }
92
- }
93
- }
94
- for (const obj of objects) {
95
- // Source-level mirror of core's `getViewModalities`: a view renders on the
96
- // explicit `modalities: [...]` list when present, otherwise the single
97
- // `viewType` (default "gui"). The view is an XR view when "xr" is among them.
98
- const modalitiesMatch = obj.match(/modalities:\s*\[([^\]]*)\]/);
99
- const modalities = modalitiesMatch
100
- ? [...modalitiesMatch[1].matchAll(/"([^"]+)"/g)].map((m) => m[1])
101
- : [obj.match(/viewType:\s*"([^"]+)"/)?.[1] ?? "gui"];
102
- if (!modalities.includes("xr")) continue;
103
- const id = obj.match(/\bid:\s*"([^"]+)"/)?.[1];
104
- const componentExport = obj.match(/componentExport:\s*"([^"]+)"/)?.[1];
105
- const bundlePath = obj.match(/bundlePath:\s*"([^"]+)"/)?.[1];
106
- if (id && componentExport && bundlePath) {
107
- results.push({ id, componentExport, bundlePath });
108
- }
109
- }
110
- return results;
111
- }
112
-
113
- // The 18 plugin manifests → (plugin directory, manifest path)
114
- const PLUGIN_BUNDLES: Array<{ pluginDir: string; manifestPath: string }> = [
115
- {
116
- pluginDir: "plugins/plugin-companion",
117
- manifestPath: "plugins/plugin-companion/src/plugin.ts",
118
- },
119
- {
120
- pluginDir: "plugins/plugin-contacts",
121
- manifestPath: "plugins/plugin-contacts/src/plugin.ts",
122
- },
123
- {
124
- pluginDir: "plugins/plugin-hyperliquid-app",
125
- manifestPath: "plugins/plugin-hyperliquid-app/src/plugin.ts",
126
- },
127
- {
128
- pluginDir: "plugins/plugin-messages",
129
- manifestPath: "plugins/plugin-messages/src/plugin.ts",
130
- },
131
- {
132
- pluginDir: "plugins/app-model-tester",
133
- manifestPath: "plugins/app-model-tester/src/plugin.ts",
134
- },
135
- {
136
- pluginDir: "plugins/plugin-phone",
137
- manifestPath: "plugins/plugin-phone/src/plugin.ts",
138
- },
139
- {
140
- pluginDir: "plugins/plugin-polymarket-app",
141
- manifestPath: "plugins/plugin-polymarket-app/src/plugin.ts",
142
- },
143
- {
144
- pluginDir: "plugins/plugin-shopify-ui",
145
- manifestPath: "plugins/plugin-shopify-ui/src/plugin.ts",
146
- },
147
- {
148
- pluginDir: "plugins/plugin-steward-app",
149
- manifestPath: "plugins/plugin-steward-app/src/plugin.ts",
150
- },
151
- {
152
- pluginDir: "plugins/plugin-vincent",
153
- manifestPath: "plugins/plugin-vincent/src/plugin.ts",
154
- },
155
- {
156
- pluginDir: "plugins/plugin-wallet-ui",
157
- manifestPath: "plugins/plugin-wallet-ui/src/plugin.ts",
158
- },
159
- {
160
- pluginDir: "plugins/plugin-feed",
161
- manifestPath: "plugins/plugin-feed/src/index.ts",
162
- },
163
- {
164
- pluginDir: "plugins/plugin-app-control",
165
- manifestPath: "plugins/plugin-app-control/src/index.ts",
166
- },
167
- {
168
- pluginDir: "plugins/plugin-screenshare",
169
- manifestPath: "plugins/plugin-screenshare/src/index.ts",
170
- },
171
- {
172
- pluginDir: "plugins/plugin-task-coordinator",
173
- manifestPath: "plugins/plugin-task-coordinator/src/index.ts",
174
- },
175
- {
176
- pluginDir: "plugins/plugin-trajectory-logger",
177
- manifestPath: "plugins/plugin-trajectory-logger/src/plugin.ts",
178
- },
179
- {
180
- pluginDir: "plugins/plugin-training",
181
- manifestPath: "plugins/plugin-training/src/setup-routes.ts",
182
- },
183
- {
184
- pluginDir: "plugins/plugin-facewear",
185
- manifestPath: "plugins/plugin-facewear/src/index.ts",
186
- },
187
- ];
188
-
189
- describe("XR view bundle coverage — all 18 plugin bundles built and valid", () => {
190
- it("declares dist/views/bundle.js for every plugin with an XR view", () => {
191
- const missingDeclarations: string[] = [];
192
- for (const { pluginDir, manifestPath } of PLUGIN_BUNDLES) {
193
- const xrViews = extractXrViews(readFile(manifestPath));
194
- if (xrViews.length === 0) {
195
- missingDeclarations.push(pluginDir);
196
- }
197
- }
198
- expect(
199
- missingDeclarations,
200
- "plugins without view build declarations",
201
- ).toEqual([]);
202
- });
203
-
204
- it("dist/views/bundle.js exists for every plugin with an XR view", () => {
205
- expect(
206
- missingBundlePaths(),
207
- "plugins with missing XR view bundles (run each plugin's build:views)",
208
- ).toEqual([]);
209
- });
210
-
211
- it("built bundle.js files are non-empty (at least 1 KB of content)", () => {
212
- const tooSmall: string[] = [];
213
- for (const { pluginDir } of PLUGIN_BUNDLES) {
214
- const bundlePath = bundlePathFor(pluginDir);
215
- const size = fileSize(bundlePath);
216
- if (size < 1024) {
217
- tooSmall.push(`${bundlePath}: ${size} bytes`);
218
- }
219
- }
220
- expect(tooSmall, "bundles too small to contain real content").toEqual([]);
221
- });
222
-
223
- it("every bundle.js starts with valid JavaScript (not HTML or JSON)", () => {
224
- const invalid: string[] = [];
225
- for (const { pluginDir } of PLUGIN_BUNDLES) {
226
- const bundlePath = bundlePathFor(pluginDir);
227
- if (!fileExists(bundlePath)) {
228
- invalid.push(`${bundlePath}: missing`);
229
- continue;
230
- }
231
- const first = readFile(bundlePath).trimStart().slice(0, 20);
232
- if (first.startsWith("<") || first.startsWith("{")) {
233
- invalid.push(`${bundlePath}: starts with "${first}"`);
234
- }
235
- }
236
- expect(invalid, "bundles with invalid content type").toEqual([]);
237
- });
238
-
239
- it("every bundle.js contains the componentExport declared in the plugin manifest", () => {
240
- const mismatches: string[] = [];
241
- for (const { pluginDir, manifestPath } of PLUGIN_BUNDLES) {
242
- const bundlePath = bundlePathFor(pluginDir);
243
- if (!fileExists(bundlePath)) {
244
- mismatches.push(`${bundlePath}: missing`);
245
- continue;
246
- }
247
-
248
- const manifestSource = readFile(manifestPath);
249
- const xrViews = extractXrViews(manifestSource);
250
- const bundle = readFile(bundlePath);
251
-
252
- for (const view of xrViews) {
253
- // componentExport may be a full path like "@pkg/name#ExportName" — extract just the export name
254
- const exportName = view.componentExport.includes("#")
255
- ? (view.componentExport.split("#").pop() ?? view.componentExport)
256
- : view.componentExport;
257
- if (!bundle.includes(exportName)) {
258
- mismatches.push(
259
- `${pluginDir}: bundle does not contain export "${exportName}" (from manifest componentExport "${view.componentExport}" for view "${view.id}")`,
260
- );
261
- }
262
- }
263
- }
264
- expect(
265
- mismatches,
266
- "bundles missing their declared componentExport",
267
- ).toEqual([]);
268
- });
269
-
270
- it("bundle.js size is consistent with real plugin content", () => {
271
- // A real built view bundle should be at least 5 KB. Empty or skeletal files are typically < 1 KB.
272
- const tooSmall: string[] = [];
273
- for (const { pluginDir } of PLUGIN_BUNDLES) {
274
- const bundlePath = `${pluginDir}/dist/views/bundle.js`;
275
- const size = fileSize(bundlePath);
276
- if (size > 0 && size < 5000) {
277
- tooSmall.push(
278
- `${bundlePath}: ${size} bytes (expected ≥ 5 KB for real content)`,
279
- );
280
- }
281
- }
282
- expect(tooSmall, "suspiciously small bundles").toEqual([]);
283
- });
284
-
285
- it("plugin manifest bundlePath uses the standard view bundle location", () => {
286
- const mismatches: string[] = [];
287
- for (const { pluginDir, manifestPath } of PLUGIN_BUNDLES) {
288
- const manifestSource = readFile(manifestPath);
289
- const xrViews = extractXrViews(manifestSource);
290
- for (const view of xrViews) {
291
- if (view.bundlePath !== "dist/views/bundle.js") {
292
- mismatches.push(
293
- `${pluginDir}: manifest says bundlePath="${view.bundlePath}"`,
294
- );
295
- }
296
- }
297
- }
298
- expect(
299
- mismatches,
300
- "manifest bundlePath using non-standard locations",
301
- ).toEqual([]);
302
- });
303
- });