@neuroverseos/governance 0.3.4 → 0.4.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.
Files changed (98) hide show
  1. package/README.md +280 -405
  2. package/dist/adapters/autoresearch.cjs +63 -9
  3. package/dist/adapters/autoresearch.d.cts +1 -1
  4. package/dist/adapters/autoresearch.d.ts +1 -1
  5. package/dist/adapters/autoresearch.js +3 -3
  6. package/dist/adapters/deep-agents.cjs +63 -9
  7. package/dist/adapters/deep-agents.d.cts +2 -2
  8. package/dist/adapters/deep-agents.d.ts +2 -2
  9. package/dist/adapters/deep-agents.js +3 -3
  10. package/dist/adapters/express.cjs +63 -9
  11. package/dist/adapters/express.d.cts +1 -1
  12. package/dist/adapters/express.d.ts +1 -1
  13. package/dist/adapters/express.js +3 -3
  14. package/dist/adapters/index.cjs +896 -9
  15. package/dist/adapters/index.d.cts +278 -2
  16. package/dist/adapters/index.d.ts +278 -2
  17. package/dist/adapters/index.js +45 -8
  18. package/dist/adapters/langchain.cjs +63 -9
  19. package/dist/adapters/langchain.d.cts +2 -2
  20. package/dist/adapters/langchain.d.ts +2 -2
  21. package/dist/adapters/langchain.js +3 -3
  22. package/dist/adapters/openai.cjs +63 -9
  23. package/dist/adapters/openai.d.cts +2 -2
  24. package/dist/adapters/openai.d.ts +2 -2
  25. package/dist/adapters/openai.js +3 -3
  26. package/dist/adapters/openclaw.cjs +63 -9
  27. package/dist/adapters/openclaw.d.cts +2 -2
  28. package/dist/adapters/openclaw.d.ts +2 -2
  29. package/dist/adapters/openclaw.js +3 -3
  30. package/dist/{add-ROOZLU62.js → add-LYHDZ5RL.js} +1 -1
  31. package/dist/{behavioral-MJO34S6Q.js → behavioral-SPWPGYXL.js} +2 -2
  32. package/dist/{bootstrap-CQRZVOXK.js → bootstrap-IP5QMC3Q.js} +2 -2
  33. package/dist/{bootstrap-emitter-Q7UIJZ2O.js → bootstrap-emitter-GIMOJFOC.js} +1 -1
  34. package/dist/{bootstrap-parser-EEF36XDU.js → bootstrap-parser-LBLGVEMU.js} +1 -1
  35. package/dist/browser.global.js +149 -5
  36. package/dist/{build-ZHPMX5AZ.js → build-THUEYMVT.js} +3 -3
  37. package/dist/{chunk-G7DJ6VOD.js → chunk-25XHSTPT.js} +2 -2
  38. package/dist/{chunk-A7GKPPU7.js → chunk-2VAWP6FI.js} +1 -1
  39. package/dist/{chunk-EMQDLDAF.js → chunk-3NZMMSOW.js} +80 -2
  40. package/dist/{chunk-B6OXJLJ5.js → chunk-5JUZ4HL7.js} +2 -2
  41. package/dist/{chunk-VXHSMA3I.js → chunk-6CV4XG3J.js} +1 -1
  42. package/dist/{chunk-5TPFNWRU.js → chunk-7D7PZLB7.js} +3 -3
  43. package/dist/{chunk-ZWI3NIXK.js → chunk-7QIAF377.js} +54 -3
  44. package/dist/chunk-APU4OZIP.js +828 -0
  45. package/dist/{chunk-CTZHONLA.js → chunk-BXLTEUS4.js} +2 -2
  46. package/dist/{chunk-O5ABKEA7.js → chunk-DWHUZUEY.js} +2 -2
  47. package/dist/{chunk-U6U7EJZL.js → chunk-JKGPSFGH.js} +2 -2
  48. package/dist/{chunk-3WQLXYTP.js → chunk-MFKHTE5R.js} +2 -2
  49. package/dist/{chunk-TG6SEF24.js → chunk-OQU65525.js} +1 -1
  50. package/dist/{chunk-YEKMVDWK.js → chunk-QZ666FCV.js} +2 -2
  51. package/dist/{chunk-4FLICVVA.js → chunk-TD5GKIHP.js} +2 -2
  52. package/dist/{chunk-IS4WUH6Y.js → chunk-UTH7OXTM.js} +2 -2
  53. package/dist/{chunk-BNKJPUPQ.js → chunk-V4FZHJQX.js} +2 -2
  54. package/dist/{chunk-F66BVUYB.js → chunk-Y6WXAPKY.js} +3 -3
  55. package/dist/{chunk-QXBFT7NI.js → chunk-YNYCQECH.js} +2 -2
  56. package/dist/{chunk-PVTQQS3Y.js → chunk-YPCVY4GS.js} +31 -0
  57. package/dist/{chunk-W7LLXRGY.js → chunk-ZAF6JH23.js} +65 -10
  58. package/dist/cli/neuroverse.cjs +3031 -182
  59. package/dist/cli/neuroverse.js +39 -23
  60. package/dist/cli/plan.cjs +176 -12
  61. package/dist/cli/plan.js +2 -2
  62. package/dist/cli/run.cjs +63 -9
  63. package/dist/cli/run.js +2 -2
  64. package/dist/configure-world-XU2COHOZ.js +705 -0
  65. package/dist/{decision-flow-M63D47LO.js → decision-flow-3K4D72G4.js} +2 -2
  66. package/dist/{demo-G43RLCPK.js → demo-66MMJTEH.js} +3 -3
  67. package/dist/{derive-LMDUTXDD.js → derive-5LOMN7GO.js} +4 -4
  68. package/dist/{doctor-6BC6X2VO.js → doctor-WIO4FLA3.js} +2 -1
  69. package/dist/{equity-penalties-SG5IZQ7I.js → equity-penalties-WWC7UDQD.js} +3 -3
  70. package/dist/{explain-RHBU2GBR.js → explain-MUSGDT67.js} +1 -1
  71. package/dist/{guard-AEEJNWLD.js → guard-W3BMQPBJ.js} +3 -3
  72. package/dist/{guard-contract-B7lplwm9.d.ts → guard-contract-CLBbTGK_.d.cts} +91 -1
  73. package/dist/{guard-contract-B7lplwm9.d.cts → guard-contract-CLBbTGK_.d.ts} +91 -1
  74. package/dist/{guard-engine-PNR6MHCM.js → guard-engine-N7TUIUU7.js} +5 -3
  75. package/dist/{impact-3XVDSCBU.js → impact-WIAM66IH.js} +3 -3
  76. package/dist/{improve-TQP4ECSY.js → improve-PJDAWW4Q.js} +3 -3
  77. package/dist/index.cjs +230 -14
  78. package/dist/index.d.cts +72 -3
  79. package/dist/index.d.ts +72 -3
  80. package/dist/index.js +24 -22
  81. package/dist/{init-FYPV4SST.js → init-TKIJDR7I.js} +5 -1
  82. package/dist/lens-IP6GIZ2Q.js +1017 -0
  83. package/dist/{mcp-server-5Y3ZM7TV.js → mcp-server-OG3PPVD2.js} +3 -3
  84. package/dist/mentraos-YFS7FMJH.js +48 -0
  85. package/dist/{playground-VZBNPPBO.js → playground-4BK2XQ47.js} +2 -2
  86. package/dist/{redteam-MZPZD3EF.js → redteam-BRZALBPP.js} +2 -2
  87. package/dist/{session-JYOARW54.js → session-SGRUT2UH.js} +3 -3
  88. package/dist/{shared-C_zpdvBm.d.cts → shared-BGzmYP5g.d.cts} +1 -1
  89. package/dist/{shared-Cf7yxx4-.d.ts → shared-CwGpPheR.d.ts} +1 -1
  90. package/dist/{simulate-LJXYBC6M.js → simulate-FGXKIH7V.js} +17 -4
  91. package/dist/{test-BOOR4A5F.js → test-PT44BSYG.js} +2 -2
  92. package/dist/{trace-PKV4KX56.js → trace-2YDNAXMK.js} +2 -2
  93. package/dist/{validate-RALX7CZS.js → validate-Q5O5TGLT.js} +1 -1
  94. package/dist/{world-BIP4GZBZ.js → world-V52ZMH26.js} +1 -1
  95. package/dist/{world-loader-Y6HMQH2D.js → world-loader-C4D3VPP3.js} +1 -1
  96. package/dist/worlds/mentraos-smartglasses.nv-world.md +423 -0
  97. package/dist/worlds/user-rules.nv-world.md +328 -0
  98. package/package.json +1 -1
@@ -0,0 +1,828 @@
1
+ import {
2
+ buildEngineOptions,
3
+ trackPlanProgress
4
+ } from "./chunk-5U2MQO5P.js";
5
+ import {
6
+ evaluateGuard
7
+ } from "./chunk-ZAF6JH23.js";
8
+ import {
9
+ loadWorld
10
+ } from "./chunk-BXLTEUS4.js";
11
+
12
+ // src/worlds/mentraos-intent-taxonomy.ts
13
+ var MENTRA_INTENT_TAXONOMY = [
14
+ // ── Camera Domain ───────────────────────────────────────────────────────
15
+ {
16
+ intent: "camera_photo_capture",
17
+ description: "Capture a single photo from the glasses camera",
18
+ sdk_method: "session.camera.requestPhoto()",
19
+ permission: "CAMERA",
20
+ domain: "camera",
21
+ supported_glasses: ["mentra_live"],
22
+ action_category: "write",
23
+ base_risk: "high",
24
+ exfiltration_risk: true,
25
+ reversible: false
26
+ },
27
+ {
28
+ intent: "camera_stream_start",
29
+ description: "Start a managed video stream (HLS) from the glasses camera",
30
+ sdk_method: "session.camera.startManagedStream()",
31
+ permission: "CAMERA",
32
+ domain: "camera",
33
+ supported_glasses: ["mentra_live"],
34
+ action_category: "write",
35
+ base_risk: "critical",
36
+ exfiltration_risk: true,
37
+ reversible: true
38
+ },
39
+ {
40
+ intent: "camera_stream_stop",
41
+ description: "Stop an active camera stream",
42
+ sdk_method: "session.camera.stopStream()",
43
+ permission: "CAMERA",
44
+ domain: "camera",
45
+ supported_glasses: ["mentra_live"],
46
+ action_category: "write",
47
+ base_risk: "low",
48
+ exfiltration_risk: false,
49
+ reversible: false
50
+ },
51
+ {
52
+ intent: "camera_restream_start",
53
+ description: "Restream camera feed to an external RTMP destination (e.g., social media)",
54
+ sdk_method: "session.camera.startRestream()",
55
+ permission: "CAMERA",
56
+ domain: "camera",
57
+ supported_glasses: ["mentra_live"],
58
+ action_category: "network",
59
+ base_risk: "critical",
60
+ exfiltration_risk: true,
61
+ reversible: true
62
+ },
63
+ // ── Microphone Domain ──────────────────────────────────────────────────
64
+ {
65
+ intent: "microphone_transcription_start",
66
+ description: "Start receiving speech-to-text transcription events",
67
+ sdk_method: "session.events.onTranscription()",
68
+ permission: "MICROPHONE",
69
+ domain: "microphone",
70
+ supported_glasses: ["even_realities_g1", "mentra_live"],
71
+ action_category: "read",
72
+ base_risk: "medium",
73
+ exfiltration_risk: true,
74
+ reversible: true
75
+ },
76
+ {
77
+ intent: "microphone_translation_start",
78
+ description: "Start receiving translation events from spoken audio",
79
+ sdk_method: "session.events.onTranslation()",
80
+ permission: "MICROPHONE",
81
+ domain: "microphone",
82
+ supported_glasses: ["even_realities_g1", "mentra_live"],
83
+ action_category: "read",
84
+ base_risk: "medium",
85
+ exfiltration_risk: true,
86
+ reversible: true
87
+ },
88
+ {
89
+ intent: "microphone_phone_passthrough",
90
+ description: "Use phone microphone as audio input (glasses without built-in mic)",
91
+ sdk_method: "session.audio.startPhoneMic()",
92
+ permission: "MICROPHONE",
93
+ domain: "microphone",
94
+ supported_glasses: ["mentra_mach1", "vuzix_z100"],
95
+ action_category: "read",
96
+ base_risk: "medium",
97
+ exfiltration_risk: true,
98
+ reversible: true
99
+ },
100
+ // ── Display Domain ────────────────────────────────────────────────────
101
+ {
102
+ intent: "display_text_wall",
103
+ description: "Show a single text block on the glasses display",
104
+ sdk_method: "session.layouts.showTextWall()",
105
+ permission: "NONE",
106
+ domain: "display",
107
+ supported_glasses: ["even_realities_g1", "mentra_mach1", "vuzix_z100"],
108
+ action_category: "write",
109
+ base_risk: "low",
110
+ exfiltration_risk: false,
111
+ reversible: true
112
+ },
113
+ {
114
+ intent: "display_double_text_wall",
115
+ description: "Show two text blocks (top/bottom) on the glasses display",
116
+ sdk_method: "session.layouts.showDoubleTextWall()",
117
+ permission: "NONE",
118
+ domain: "display",
119
+ supported_glasses: ["even_realities_g1", "mentra_mach1", "vuzix_z100"],
120
+ action_category: "write",
121
+ base_risk: "low",
122
+ exfiltration_risk: false,
123
+ reversible: true
124
+ },
125
+ {
126
+ intent: "display_reference_card",
127
+ description: "Show a reference card layout with structured content",
128
+ sdk_method: "session.layouts.showReferenceCard()",
129
+ permission: "NONE",
130
+ domain: "display",
131
+ supported_glasses: ["even_realities_g1"],
132
+ action_category: "write",
133
+ base_risk: "low",
134
+ exfiltration_risk: false,
135
+ reversible: true
136
+ },
137
+ {
138
+ intent: "display_dashboard_card",
139
+ description: "Show a dashboard card layout",
140
+ sdk_method: "session.layouts.showDashboardCard()",
141
+ permission: "NONE",
142
+ domain: "display",
143
+ supported_glasses: ["even_realities_g1"],
144
+ action_category: "write",
145
+ base_risk: "low",
146
+ exfiltration_risk: false,
147
+ reversible: true
148
+ },
149
+ {
150
+ intent: "display_image",
151
+ description: "Display an image on the glasses",
152
+ sdk_method: "session.layouts.showImage()",
153
+ permission: "NONE",
154
+ domain: "display",
155
+ supported_glasses: ["even_realities_g1"],
156
+ action_category: "write",
157
+ base_risk: "low",
158
+ exfiltration_risk: false,
159
+ reversible: true
160
+ },
161
+ // ── Dashboard Domain ──────────────────────────────────────────────────
162
+ {
163
+ intent: "dashboard_update_main",
164
+ description: "Update the persistent dashboard content (compact mode)",
165
+ sdk_method: "session.dashboard.content.setMain()",
166
+ permission: "NONE",
167
+ domain: "dashboard",
168
+ supported_glasses: ["even_realities_g1", "mentra_mach1", "vuzix_z100"],
169
+ action_category: "write",
170
+ base_risk: "low",
171
+ exfiltration_risk: false,
172
+ reversible: true
173
+ },
174
+ {
175
+ intent: "dashboard_update_expanded",
176
+ description: "Update the expanded dashboard content (user-opened mode)",
177
+ sdk_method: "session.dashboard.content.setExpanded()",
178
+ permission: "NONE",
179
+ domain: "dashboard",
180
+ supported_glasses: ["even_realities_g1", "mentra_mach1", "vuzix_z100"],
181
+ action_category: "write",
182
+ base_risk: "low",
183
+ exfiltration_risk: false,
184
+ reversible: true
185
+ },
186
+ // ── Location Domain ───────────────────────────────────────────────────
187
+ {
188
+ intent: "location_access",
189
+ description: "Access current location data from the paired phone",
190
+ sdk_method: "session.location.get()",
191
+ permission: "LOCATION",
192
+ domain: "location",
193
+ supported_glasses: ["even_realities_g1", "mentra_live", "mentra_mach1", "vuzix_z100"],
194
+ action_category: "read",
195
+ base_risk: "medium",
196
+ exfiltration_risk: true,
197
+ reversible: false
198
+ },
199
+ {
200
+ intent: "location_continuous_sharing",
201
+ description: "Start continuous location updates to the app server",
202
+ sdk_method: "session.location.startContinuous()",
203
+ permission: "LOCATION",
204
+ domain: "location",
205
+ supported_glasses: ["even_realities_g1", "mentra_live", "mentra_mach1", "vuzix_z100"],
206
+ action_category: "network",
207
+ base_risk: "high",
208
+ exfiltration_risk: true,
209
+ reversible: true
210
+ },
211
+ // ── Calendar & Notifications ──────────────────────────────────────────
212
+ {
213
+ intent: "calendar_read",
214
+ description: "Read calendar events from the paired phone",
215
+ sdk_method: "session.calendar.getEvents()",
216
+ permission: "CALENDAR",
217
+ domain: "calendar",
218
+ supported_glasses: ["even_realities_g1", "mentra_live", "mentra_mach1", "vuzix_z100"],
219
+ action_category: "read",
220
+ base_risk: "low",
221
+ exfiltration_risk: false,
222
+ reversible: true
223
+ },
224
+ {
225
+ intent: "notifications_read",
226
+ description: "Read phone notifications",
227
+ sdk_method: "session.notifications.getRecent()",
228
+ permission: "READ_NOTIFICATIONS",
229
+ domain: "notifications",
230
+ supported_glasses: ["even_realities_g1", "mentra_live", "mentra_mach1", "vuzix_z100"],
231
+ action_category: "read",
232
+ base_risk: "low",
233
+ exfiltration_risk: false,
234
+ reversible: true
235
+ },
236
+ // ── Audio Domain ──────────────────────────────────────────────────────
237
+ {
238
+ intent: "audio_play",
239
+ description: "Play audio through the glasses speaker",
240
+ sdk_method: "session.audio.play()",
241
+ permission: "NONE",
242
+ domain: "audio",
243
+ supported_glasses: ["mentra_live"],
244
+ action_category: "write",
245
+ base_risk: "low",
246
+ exfiltration_risk: false,
247
+ reversible: true
248
+ },
249
+ // ── Session Domain ────────────────────────────────────────────────────
250
+ {
251
+ intent: "session_data_export",
252
+ description: "Export session data to external storage or API",
253
+ sdk_method: "session.export()",
254
+ permission: "NONE",
255
+ domain: "session",
256
+ supported_glasses: ["even_realities_g1", "mentra_live", "mentra_mach1", "vuzix_z100"],
257
+ action_category: "network",
258
+ base_risk: "high",
259
+ exfiltration_risk: true,
260
+ reversible: false
261
+ },
262
+ // ── Tool Call Domain ──────────────────────────────────────────────────
263
+ {
264
+ intent: "tool_call_execute",
265
+ description: "Execute a custom tool call defined by the app via handleToolCall",
266
+ sdk_method: "AppServer.handleToolCall()",
267
+ permission: "NONE",
268
+ domain: "tool_call",
269
+ supported_glasses: ["even_realities_g1", "mentra_live", "mentra_mach1", "vuzix_z100"],
270
+ action_category: "other",
271
+ base_risk: "medium",
272
+ exfiltration_risk: false,
273
+ reversible: false
274
+ },
275
+ // ── AI Data Flow Domain ─────────────────────────────────────────────────
276
+ // These intents govern what user data apps send to their AI backends.
277
+ // They operate at the app server layer (not the glasses hardware layer),
278
+ // so they work on all glasses models and require no hardware permission.
279
+ {
280
+ intent: "ai_send_transcription",
281
+ description: "Send user speech transcription to an external AI API for processing",
282
+ sdk_method: "app_server.ai.sendTranscription()",
283
+ permission: "NONE",
284
+ domain: "ai_data",
285
+ supported_glasses: ["even_realities_g1", "mentra_live", "mentra_mach1", "vuzix_z100"],
286
+ action_category: "network",
287
+ base_risk: "medium",
288
+ exfiltration_risk: true,
289
+ reversible: false
290
+ },
291
+ {
292
+ intent: "ai_send_image",
293
+ description: "Send a camera-captured image to an external AI API for vision analysis",
294
+ sdk_method: "app_server.ai.sendImage()",
295
+ permission: "NONE",
296
+ domain: "ai_data",
297
+ supported_glasses: ["even_realities_g1", "mentra_live", "mentra_mach1", "vuzix_z100"],
298
+ action_category: "network",
299
+ base_risk: "high",
300
+ exfiltration_risk: true,
301
+ reversible: false
302
+ },
303
+ {
304
+ intent: "ai_send_location",
305
+ description: "Send user location data to an external AI API for context-aware processing",
306
+ sdk_method: "app_server.ai.sendLocation()",
307
+ permission: "NONE",
308
+ domain: "ai_data",
309
+ supported_glasses: ["even_realities_g1", "mentra_live", "mentra_mach1", "vuzix_z100"],
310
+ action_category: "network",
311
+ base_risk: "medium",
312
+ exfiltration_risk: true,
313
+ reversible: false
314
+ },
315
+ {
316
+ intent: "ai_send_calendar",
317
+ description: "Send user calendar data to an external AI API for scheduling assistance",
318
+ sdk_method: "app_server.ai.sendCalendar()",
319
+ permission: "NONE",
320
+ domain: "ai_data",
321
+ supported_glasses: ["even_realities_g1", "mentra_live", "mentra_mach1", "vuzix_z100"],
322
+ action_category: "network",
323
+ base_risk: "medium",
324
+ exfiltration_risk: true,
325
+ reversible: false
326
+ },
327
+ {
328
+ intent: "ai_send_notifications",
329
+ description: "Send user notification data to an external AI API for summarization or triage",
330
+ sdk_method: "app_server.ai.sendNotifications()",
331
+ permission: "NONE",
332
+ domain: "ai_data",
333
+ supported_glasses: ["even_realities_g1", "mentra_live", "mentra_mach1", "vuzix_z100"],
334
+ action_category: "network",
335
+ base_risk: "medium",
336
+ exfiltration_risk: true,
337
+ reversible: false
338
+ },
339
+ // ── AI Action Domain ──────────────────────────────────────────────────
340
+ // These intents govern actions AI takes on behalf of the user.
341
+ // Every action here must be shown on the glasses display before execution.
342
+ {
343
+ intent: "ai_auto_respond_message",
344
+ description: "AI generates and sends a message (email, SMS, chat) on the user's behalf",
345
+ sdk_method: "app_server.ai.sendMessage()",
346
+ permission: "NONE",
347
+ domain: "ai_action",
348
+ supported_glasses: ["even_realities_g1", "mentra_live", "mentra_mach1", "vuzix_z100"],
349
+ action_category: "network",
350
+ base_risk: "high",
351
+ exfiltration_risk: true,
352
+ reversible: false
353
+ },
354
+ {
355
+ intent: "ai_auto_purchase",
356
+ description: "AI initiates a financial transaction (purchase, subscription, tip) on the user's behalf",
357
+ sdk_method: "app_server.ai.purchase()",
358
+ permission: "NONE",
359
+ domain: "ai_action",
360
+ supported_glasses: ["even_realities_g1", "mentra_live", "mentra_mach1", "vuzix_z100"],
361
+ action_category: "network",
362
+ base_risk: "critical",
363
+ exfiltration_risk: true,
364
+ reversible: false
365
+ },
366
+ {
367
+ intent: "ai_auto_schedule",
368
+ description: "AI creates, modifies, or cancels a calendar event on the user's behalf",
369
+ sdk_method: "app_server.ai.schedule()",
370
+ permission: "NONE",
371
+ domain: "ai_action",
372
+ supported_glasses: ["even_realities_g1", "mentra_live", "mentra_mach1", "vuzix_z100"],
373
+ action_category: "write",
374
+ base_risk: "medium",
375
+ exfiltration_risk: false,
376
+ reversible: true
377
+ },
378
+ {
379
+ intent: "ai_auto_setting_change",
380
+ description: "AI changes a user setting or app configuration on the user's behalf",
381
+ sdk_method: "app_server.ai.changeSetting()",
382
+ permission: "NONE",
383
+ domain: "ai_action",
384
+ supported_glasses: ["even_realities_g1", "mentra_live", "mentra_mach1", "vuzix_z100"],
385
+ action_category: "write",
386
+ base_risk: "medium",
387
+ exfiltration_risk: false,
388
+ reversible: true
389
+ },
390
+ {
391
+ intent: "ai_retain_session_data",
392
+ description: "AI or app retains user session data (transcriptions, images, conversation) beyond session end",
393
+ sdk_method: "app_server.ai.retainData()",
394
+ permission: "NONE",
395
+ domain: "ai_data",
396
+ supported_glasses: ["even_realities_g1", "mentra_live", "mentra_mach1", "vuzix_z100"],
397
+ action_category: "write",
398
+ base_risk: "high",
399
+ exfiltration_risk: true,
400
+ reversible: false
401
+ },
402
+ {
403
+ intent: "ai_share_with_third_party",
404
+ description: "AI or app shares user data with a third-party service beyond the declared AI provider",
405
+ sdk_method: "app_server.ai.shareExternal()",
406
+ permission: "NONE",
407
+ domain: "ai_data",
408
+ supported_glasses: ["even_realities_g1", "mentra_live", "mentra_mach1", "vuzix_z100"],
409
+ action_category: "network",
410
+ base_risk: "critical",
411
+ exfiltration_risk: true,
412
+ reversible: false
413
+ }
414
+ ];
415
+ var MENTRA_KNOWN_INTENTS = MENTRA_INTENT_TAXONOMY.map((d) => d.intent);
416
+ var MENTRA_INTENT_MAP = new Map(MENTRA_INTENT_TAXONOMY.map((d) => [d.intent, d]));
417
+ function getMentraIntent(intent) {
418
+ return MENTRA_INTENT_MAP.get(intent);
419
+ }
420
+ function getIntentsByPermission(permission) {
421
+ return MENTRA_INTENT_TAXONOMY.filter((d) => d.permission === permission);
422
+ }
423
+ function getIntentsByGlasses(model) {
424
+ return MENTRA_INTENT_TAXONOMY.filter((d) => d.supported_glasses.includes(model));
425
+ }
426
+ function isIntentSupported(intent, model) {
427
+ const def = MENTRA_INTENT_MAP.get(intent);
428
+ return def ? def.supported_glasses.includes(model) : false;
429
+ }
430
+ function getHighRiskIntents() {
431
+ return MENTRA_INTENT_TAXONOMY.filter((d) => d.base_risk === "high" || d.base_risk === "critical");
432
+ }
433
+ function getExfiltrationIntents() {
434
+ return MENTRA_INTENT_TAXONOMY.filter((d) => d.exfiltration_risk);
435
+ }
436
+ function getAIDataIntents() {
437
+ return MENTRA_INTENT_TAXONOMY.filter((d) => d.domain === "ai_data");
438
+ }
439
+ function getAIActionIntents() {
440
+ return MENTRA_INTENT_TAXONOMY.filter((d) => d.domain === "ai_action");
441
+ }
442
+ function getAIIntents() {
443
+ return MENTRA_INTENT_TAXONOMY.filter((d) => d.domain === "ai_data" || d.domain === "ai_action");
444
+ }
445
+ function isAIIntent(intent) {
446
+ const def = MENTRA_INTENT_MAP.get(intent);
447
+ return def ? def.domain === "ai_data" || def.domain === "ai_action" : false;
448
+ }
449
+
450
+ // src/adapters/mentraos.ts
451
+ var DEFAULT_USER_RULES = {
452
+ aiDataPolicy: "declared_only",
453
+ aiActionPolicy: "confirm_all",
454
+ aiPurchasePolicy: "confirm_each",
455
+ aiMessagingPolicy: "confirm_each",
456
+ dataRetentionPolicy: "app_declared",
457
+ maxAIProviders: 5
458
+ };
459
+ function evaluateUserRules(intent, rules, appContext) {
460
+ const def = getMentraIntent(intent);
461
+ if (!def) return null;
462
+ if (def.domain === "ai_data" && intent !== "ai_retain_session_data") {
463
+ if (rules.aiDataPolicy === "block_all") {
464
+ return {
465
+ verdict: {
466
+ status: "BLOCK",
467
+ ruleId: "user-rule-ai-data-block",
468
+ reason: `User rules block all AI data sends. Intent: ${intent}`,
469
+ evidence: makeEvidence("user-rule-ai-data-block")
470
+ },
471
+ reason: "User has blocked all AI data sends"
472
+ };
473
+ }
474
+ if (rules.aiDataPolicy === "confirm_each") {
475
+ return {
476
+ verdict: {
477
+ status: "PAUSE",
478
+ ruleId: "user-rule-ai-data-confirm",
479
+ reason: `User rules require confirmation for every AI data send. Intent: ${intent}`,
480
+ evidence: makeEvidence("user-rule-ai-data-confirm")
481
+ },
482
+ reason: "User requires confirmation for each AI data send"
483
+ };
484
+ }
485
+ if (!appContext.aiProviderDeclared) {
486
+ return {
487
+ verdict: {
488
+ status: "BLOCK",
489
+ ruleId: "user-rule-undeclared-provider",
490
+ reason: `App "${appContext.appId}" has not declared its AI provider. User rules require declared providers only.`,
491
+ evidence: makeEvidence("user-rule-undeclared-provider")
492
+ },
493
+ reason: "App has not declared its AI provider"
494
+ };
495
+ }
496
+ }
497
+ if (intent === "ai_retain_session_data") {
498
+ if (rules.dataRetentionPolicy === "never") {
499
+ return {
500
+ verdict: {
501
+ status: "BLOCK",
502
+ ruleId: "user-rule-no-retention",
503
+ reason: `User rules block all data retention. App "${appContext.appId}" cannot retain session data.`,
504
+ evidence: makeEvidence("user-rule-no-retention")
505
+ },
506
+ reason: "User has blocked all data retention"
507
+ };
508
+ }
509
+ if (!appContext.dataRetentionOptedIn) {
510
+ return {
511
+ verdict: {
512
+ status: "BLOCK",
513
+ ruleId: "user-rule-retention-no-optin",
514
+ reason: `User has not opted in to data retention for app "${appContext.appId}".`,
515
+ evidence: makeEvidence("user-rule-retention-no-optin")
516
+ },
517
+ reason: "User has not opted in to data retention for this app"
518
+ };
519
+ }
520
+ }
521
+ if (intent === "ai_auto_purchase") {
522
+ if (rules.aiPurchasePolicy === "block_all") {
523
+ return {
524
+ verdict: {
525
+ status: "BLOCK",
526
+ ruleId: "user-rule-no-purchases",
527
+ reason: "User rules block all AI-initiated purchases.",
528
+ evidence: makeEvidence("user-rule-no-purchases")
529
+ },
530
+ reason: "User has blocked all AI purchases"
531
+ };
532
+ }
533
+ return {
534
+ verdict: {
535
+ status: "PAUSE",
536
+ ruleId: "user-rule-purchase-confirm",
537
+ reason: `AI wants to make a purchase. User rules require per-transaction confirmation.`,
538
+ evidence: makeEvidence("user-rule-purchase-confirm")
539
+ },
540
+ reason: "User requires per-transaction confirmation for AI purchases"
541
+ };
542
+ }
543
+ if (intent === "ai_auto_respond_message") {
544
+ if (rules.aiMessagingPolicy === "block_all") {
545
+ return {
546
+ verdict: {
547
+ status: "BLOCK",
548
+ ruleId: "user-rule-no-messaging",
549
+ reason: "User rules block all AI-initiated messaging.",
550
+ evidence: makeEvidence("user-rule-no-messaging")
551
+ },
552
+ reason: "User has blocked all AI messaging"
553
+ };
554
+ }
555
+ return {
556
+ verdict: {
557
+ status: "PAUSE",
558
+ ruleId: "user-rule-message-confirm",
559
+ reason: `AI wants to send a message on your behalf. User rules require per-message confirmation.`,
560
+ evidence: makeEvidence("user-rule-message-confirm")
561
+ },
562
+ reason: "User requires per-message confirmation for AI messaging"
563
+ };
564
+ }
565
+ if (def.domain === "ai_action" && intent !== "ai_auto_purchase" && intent !== "ai_auto_respond_message") {
566
+ if (rules.aiActionPolicy === "block_all") {
567
+ return {
568
+ verdict: {
569
+ status: "BLOCK",
570
+ ruleId: "user-rule-no-ai-actions",
571
+ reason: `User rules block all AI auto-actions. Intent: ${intent}`,
572
+ evidence: makeEvidence("user-rule-no-ai-actions")
573
+ },
574
+ reason: "User has blocked all AI auto-actions"
575
+ };
576
+ }
577
+ if (rules.aiActionPolicy === "confirm_all") {
578
+ return {
579
+ verdict: {
580
+ status: "PAUSE",
581
+ ruleId: "user-rule-action-confirm",
582
+ reason: `AI wants to take action: ${intent}. User rules require confirmation.`,
583
+ evidence: makeEvidence("user-rule-action-confirm")
584
+ },
585
+ reason: "User requires confirmation for all AI actions"
586
+ };
587
+ }
588
+ if (def.base_risk === "high" || def.base_risk === "critical") {
589
+ return {
590
+ verdict: {
591
+ status: "PAUSE",
592
+ ruleId: "user-rule-high-risk-confirm",
593
+ reason: `AI wants to take high-risk action: ${intent}. User rules require confirmation for high-risk actions.`,
594
+ evidence: makeEvidence("user-rule-high-risk-confirm")
595
+ },
596
+ reason: "User requires confirmation for high-risk AI actions"
597
+ };
598
+ }
599
+ }
600
+ if (intent === "ai_share_with_third_party") {
601
+ return {
602
+ verdict: {
603
+ status: "PAUSE",
604
+ ruleId: "user-rule-third-party-confirm",
605
+ reason: `App wants to share your data with a third party beyond its declared AI provider. Confirmation required.`,
606
+ evidence: makeEvidence("user-rule-third-party-confirm")
607
+ },
608
+ reason: "Third-party data sharing requires user confirmation"
609
+ };
610
+ }
611
+ return null;
612
+ }
613
+ function makeEvidence(ruleId) {
614
+ return {
615
+ worldId: "mentraos-user-rules",
616
+ worldName: "MentraOS User Rules",
617
+ worldVersion: "1.0.0",
618
+ evaluatedAt: Date.now(),
619
+ invariantsSatisfied: 0,
620
+ invariantsTotal: 0,
621
+ guardsMatched: [ruleId],
622
+ rulesMatched: [],
623
+ enforcementLevel: "strict"
624
+ };
625
+ }
626
+ var MentraGovernedExecutor = class {
627
+ world;
628
+ engineOptions;
629
+ options;
630
+ planState;
631
+ planCallbacks;
632
+ _userRules;
633
+ _emergencyOverride = false;
634
+ _emergencyActivatedAt = null;
635
+ constructor(world, options = {}, userRules = DEFAULT_USER_RULES) {
636
+ this.world = world;
637
+ this.options = options;
638
+ this._userRules = userRules;
639
+ this.engineOptions = buildEngineOptions(options, options.plan);
640
+ this.planState = { activePlan: options.plan, engineOptions: this.engineOptions };
641
+ this.planCallbacks = {
642
+ onPlanProgress: options.onPlanProgress,
643
+ onPlanComplete: options.onPlanComplete
644
+ };
645
+ }
646
+ /** Get the current user rules */
647
+ get userRules() {
648
+ return this._userRules;
649
+ }
650
+ /** Update user rules at runtime (e.g., user changes preferences in phone app) */
651
+ updateUserRules(rules) {
652
+ this._userRules = { ...this._userRules, ...rules };
653
+ }
654
+ /**
655
+ * Activate emergency override — user is king.
656
+ *
657
+ * Bypasses all NeuroVerse governance rules (user rules, platform rules).
658
+ * Does NOT bypass MentraOS platform constraints (hardware capability,
659
+ * declared permissions, session isolation). You can't override physics.
660
+ *
661
+ * Returns the timestamp of activation for audit trail.
662
+ */
663
+ activateEmergencyOverride() {
664
+ this._emergencyOverride = true;
665
+ this._emergencyActivatedAt = Date.now();
666
+ this.engineOptions = { ...this.engineOptions, emergencyOverride: true };
667
+ return this._emergencyActivatedAt;
668
+ }
669
+ /**
670
+ * Deactivate emergency override — governance resumes.
671
+ * Returns the duration the override was active (ms).
672
+ */
673
+ deactivateEmergencyOverride() {
674
+ if (!this._emergencyOverride || !this._emergencyActivatedAt) {
675
+ return 0;
676
+ }
677
+ const duration = Date.now() - this._emergencyActivatedAt;
678
+ this._emergencyOverride = false;
679
+ this._emergencyActivatedAt = null;
680
+ this.engineOptions = { ...this.engineOptions, emergencyOverride: false };
681
+ return duration;
682
+ }
683
+ /** Whether emergency override is currently active */
684
+ get isEmergencyOverrideActive() {
685
+ return this._emergencyOverride;
686
+ }
687
+ /** Timestamp when emergency override was activated, or null */
688
+ get emergencyActivatedAt() {
689
+ return this._emergencyActivatedAt;
690
+ }
691
+ /**
692
+ * Evaluate an intent against user rules + platform world.
693
+ *
694
+ * Three-layer evaluation:
695
+ * 0. Emergency override — if active, skip governance (layers 1 + 3),
696
+ * but STILL enforce platform constraints (layer 2)
697
+ * 1. User rules check — personal governance override, can BLOCK or PAUSE
698
+ * 2. Hardware capability check — validates glasses support
699
+ * ↑ THIS IS A PLATFORM CONSTRAINT — never overridden
700
+ * 3. Platform guard engine — full world rule evaluation
701
+ */
702
+ evaluate(intent, appContext) {
703
+ const intentDef = getMentraIntent(intent);
704
+ const glassesModel = appContext.glassesModel;
705
+ if (!this._emergencyOverride) {
706
+ const userRulesResult = evaluateUserRules(intent, this._userRules, appContext);
707
+ if (userRulesResult) {
708
+ const allowed2 = false;
709
+ const requiresConfirmation2 = userRulesResult.verdict.status === "PAUSE";
710
+ const result2 = {
711
+ allowed: requiresConfirmation2 ? false : false,
712
+ requiresConfirmation: requiresConfirmation2,
713
+ verdict: userRulesResult.verdict,
714
+ intentDef,
715
+ userRulesResult: { reason: userRulesResult.reason },
716
+ appContext,
717
+ decidingLayer: "user_rules"
718
+ };
719
+ if (requiresConfirmation2) {
720
+ this.options.onPause?.(result2);
721
+ } else {
722
+ this.options.onBlock?.(result2);
723
+ }
724
+ this.options.onEvaluate?.(result2);
725
+ return result2;
726
+ }
727
+ }
728
+ if (intentDef && glassesModel && !intentDef.supported_glasses.includes(glassesModel)) {
729
+ const verdict2 = {
730
+ status: "BLOCK",
731
+ ruleId: "hardware-capability",
732
+ reason: `${intent} not supported on ${glassesModel} \u2014 requires: ${intentDef.supported_glasses.join(", ")}`,
733
+ evidence: {
734
+ worldId: this.world.world?.world_id ?? "unknown",
735
+ worldName: this.world.world?.name ?? "unknown",
736
+ worldVersion: this.world.world?.version ?? "unknown",
737
+ evaluatedAt: Date.now(),
738
+ invariantsSatisfied: 0,
739
+ invariantsTotal: 0,
740
+ guardsMatched: ["hardware-capability"],
741
+ rulesMatched: [],
742
+ enforcementLevel: "strict"
743
+ }
744
+ };
745
+ const result2 = {
746
+ allowed: false,
747
+ requiresConfirmation: false,
748
+ verdict: verdict2,
749
+ intentDef,
750
+ appContext,
751
+ decidingLayer: "hardware"
752
+ };
753
+ this.options.onBlock?.(result2);
754
+ this.options.onEvaluate?.(result2);
755
+ return result2;
756
+ }
757
+ const event = {
758
+ intent,
759
+ tool: intentDef?.sdk_method ?? intent,
760
+ scope: intentDef?.domain ?? "unknown",
761
+ actionCategory: intentDef?.action_category,
762
+ riskLevel: intentDef?.base_risk ?? "medium",
763
+ irreversible: intentDef ? !intentDef.reversible : false,
764
+ args: {
765
+ app_id: appContext.appId,
766
+ ai_provider_declared: appContext.aiProviderDeclared ? 1 : 0,
767
+ ai_data_types_sent: appContext.aiDataTypesSent,
768
+ ai_retention_opted_in: appContext.dataRetentionOptedIn ? 1 : 0,
769
+ glasses_model: glassesModel ?? "unknown",
770
+ is_ai_intent: isAIIntent(intent) ? 1 : 0
771
+ }
772
+ };
773
+ const verdict = evaluateGuard(event, this.world, this.engineOptions);
774
+ const allowed = verdict.status === "ALLOW" || verdict.status === "REWARD";
775
+ const requiresConfirmation = verdict.status === "PAUSE";
776
+ if (allowed) {
777
+ trackPlanProgress(event, this.planState, this.planCallbacks);
778
+ }
779
+ const result = {
780
+ allowed,
781
+ requiresConfirmation,
782
+ verdict,
783
+ intentDef,
784
+ appContext,
785
+ decidingLayer: this._emergencyOverride ? "emergency_override" : "platform"
786
+ };
787
+ if (!allowed && !requiresConfirmation) {
788
+ this.options.onBlock?.(result);
789
+ }
790
+ if (requiresConfirmation) {
791
+ this.options.onPause?.(result);
792
+ }
793
+ this.options.onEvaluate?.(result);
794
+ return result;
795
+ }
796
+ /** Get all known intents for this adapter */
797
+ get knownIntents() {
798
+ return MENTRA_KNOWN_INTENTS;
799
+ }
800
+ };
801
+ async function createMentraGovernedExecutor(worldPath, options = {}, userRules = DEFAULT_USER_RULES) {
802
+ const world = await loadWorld(worldPath);
803
+ return new MentraGovernedExecutor(world, options, userRules);
804
+ }
805
+ function createMentraGovernedExecutorFromWorld(world, options = {}, userRules = DEFAULT_USER_RULES) {
806
+ return new MentraGovernedExecutor(world, options, userRules);
807
+ }
808
+
809
+ export {
810
+ MENTRA_INTENT_TAXONOMY,
811
+ MENTRA_KNOWN_INTENTS,
812
+ MENTRA_INTENT_MAP,
813
+ getMentraIntent,
814
+ getIntentsByPermission,
815
+ getIntentsByGlasses,
816
+ isIntentSupported,
817
+ getHighRiskIntents,
818
+ getExfiltrationIntents,
819
+ getAIDataIntents,
820
+ getAIActionIntents,
821
+ getAIIntents,
822
+ isAIIntent,
823
+ DEFAULT_USER_RULES,
824
+ evaluateUserRules,
825
+ MentraGovernedExecutor,
826
+ createMentraGovernedExecutor,
827
+ createMentraGovernedExecutorFromWorld
828
+ };