@neuroverseos/governance 0.4.0 → 0.4.1

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 (105) hide show
  1. package/dist/adapters/autoresearch.d.cts +2 -1
  2. package/dist/adapters/autoresearch.d.ts +2 -1
  3. package/dist/adapters/autoresearch.js +2 -2
  4. package/dist/adapters/deep-agents.d.cts +3 -2
  5. package/dist/adapters/deep-agents.d.ts +3 -2
  6. package/dist/adapters/deep-agents.js +2 -2
  7. package/dist/adapters/express.d.cts +2 -1
  8. package/dist/adapters/express.d.ts +2 -1
  9. package/dist/adapters/express.js +2 -2
  10. package/dist/adapters/index.cjs +66 -1
  11. package/dist/adapters/index.d.cts +4 -278
  12. package/dist/adapters/index.d.ts +4 -278
  13. package/dist/adapters/index.js +33 -33
  14. package/dist/adapters/langchain.d.cts +3 -2
  15. package/dist/adapters/langchain.d.ts +3 -2
  16. package/dist/adapters/langchain.js +2 -2
  17. package/dist/adapters/mentraos.cjs +2181 -0
  18. package/dist/adapters/mentraos.d.cts +319 -0
  19. package/dist/adapters/mentraos.d.ts +319 -0
  20. package/dist/{mentraos-YFS7FMJH.js → adapters/mentraos.js} +6 -6
  21. package/dist/adapters/openai.d.cts +3 -2
  22. package/dist/adapters/openai.d.ts +3 -2
  23. package/dist/adapters/openai.js +2 -2
  24. package/dist/adapters/openclaw.d.cts +3 -2
  25. package/dist/adapters/openclaw.d.ts +3 -2
  26. package/dist/adapters/openclaw.js +2 -2
  27. package/dist/{add-LYHDZ5RL.js → add-XSANI3FK.js} +1 -1
  28. package/dist/bootstrap-contract-DcV6t-8M.d.cts +216 -0
  29. package/dist/bootstrap-contract-DcV6t-8M.d.ts +216 -0
  30. package/dist/{build-THUEYMVT.js → build-EGBGZFIJ.js} +5 -5
  31. package/dist/{chunk-MFKHTE5R.js → chunk-3AYKQHYI.js} +1 -1
  32. package/dist/chunk-3S5AD4AB.js +421 -0
  33. package/dist/{chunk-V4FZHJQX.js → chunk-A7SHG75T.js} +1 -1
  34. package/dist/{chunk-JKGPSFGH.js → chunk-AV7XJJWK.js} +1 -1
  35. package/dist/{chunk-Y6WXAPKY.js → chunk-DA5MHFRR.js} +1 -1
  36. package/dist/{chunk-7D7PZLB7.js → chunk-FS2UUJJO.js} +3 -3
  37. package/dist/{chunk-TD5GKIHP.js → chunk-FVOGUCB6.js} +1 -1
  38. package/dist/{chunk-APU4OZIP.js → chunk-GTPV2XGO.js} +67 -2
  39. package/dist/{chunk-BXLTEUS4.js → chunk-I4RTIMLX.js} +2 -2
  40. package/dist/{chunk-5JUZ4HL7.js → chunk-J2IZBHXJ.js} +3 -3
  41. package/dist/{chunk-YNYCQECH.js → chunk-QMVQ6KPL.js} +1 -1
  42. package/dist/{chunk-25XHSTPT.js → chunk-RDA7ISWC.js} +1 -1
  43. package/dist/{chunk-DWHUZUEY.js → chunk-YJ34R5NB.js} +1 -1
  44. package/dist/{chunk-UTH7OXTM.js → chunk-ZEIT2QLM.js} +3 -3
  45. package/dist/cli/neuroverse.cjs +580 -28
  46. package/dist/cli/neuroverse.js +21 -21
  47. package/dist/cli/plan.js +2 -2
  48. package/dist/cli/run.js +2 -2
  49. package/dist/{demo-66MMJTEH.js → demo-6OQYWRR6.js} +3 -3
  50. package/dist/{derive-5LOMN7GO.js → derive-7Y7YWVLU.js} +4 -4
  51. package/dist/{doctor-WIO4FLA3.js → doctor-NHXI7OQW.js} +3 -2
  52. package/dist/engine/bootstrap-emitter.cjs +241 -0
  53. package/dist/engine/bootstrap-emitter.d.cts +27 -0
  54. package/dist/engine/bootstrap-emitter.d.ts +27 -0
  55. package/dist/{bootstrap-emitter-GIMOJFOC.js → engine/bootstrap-emitter.js} +2 -2
  56. package/dist/engine/bootstrap-parser.cjs +560 -0
  57. package/dist/engine/bootstrap-parser.d.cts +96 -0
  58. package/dist/engine/bootstrap-parser.d.ts +96 -0
  59. package/dist/{bootstrap-parser-LBLGVEMU.js → engine/bootstrap-parser.js} +2 -2
  60. package/dist/engine/guard-engine.cjs +1116 -0
  61. package/dist/engine/guard-engine.d.cts +60 -0
  62. package/dist/engine/guard-engine.d.ts +60 -0
  63. package/dist/{guard-engine-N7TUIUU7.js → engine/guard-engine.js} +3 -3
  64. package/dist/engine/simulate-engine.cjs +390 -0
  65. package/dist/engine/simulate-engine.d.cts +105 -0
  66. package/dist/engine/simulate-engine.d.ts +105 -0
  67. package/dist/engine/simulate-engine.js +9 -0
  68. package/dist/{equity-penalties-WWC7UDQD.js → equity-penalties-NVBAB5WL.js} +2 -2
  69. package/dist/{explain-MUSGDT67.js → explain-HDFN4ION.js} +1 -1
  70. package/dist/github-TIKTWOGU.js +27 -0
  71. package/dist/{guard-W3BMQPBJ.js → guard-6KSCWT2W.js} +2 -2
  72. package/dist/{guard-contract-CLBbTGK_.d.cts → guard-contract-C991HDZp.d.cts} +2 -369
  73. package/dist/{guard-contract-CLBbTGK_.d.ts → guard-contract-hHjTTjtR.d.ts} +2 -369
  74. package/dist/{improve-PJDAWW4Q.js → improve-2PWGGO5B.js} +3 -3
  75. package/dist/index.cjs +452 -0
  76. package/dist/index.d.cts +231 -492
  77. package/dist/index.d.ts +231 -492
  78. package/dist/index.js +76 -55
  79. package/dist/{lens-IP6GIZ2Q.js → lens-MHMUDCMQ.js} +92 -25
  80. package/dist/{mcp-server-OG3PPVD2.js → mcp-server-TNIWZ7B5.js} +2 -2
  81. package/dist/{playground-4BK2XQ47.js → playground-3FLDGBET.js} +2 -2
  82. package/dist/{redteam-BRZALBPP.js → redteam-HV6LMKEH.js} +2 -2
  83. package/dist/{session-SGRUT2UH.js → session-XZP2754M.js} +2 -2
  84. package/dist/{shared-BGzmYP5g.d.cts → shared-DGnn1jiS.d.cts} +1 -1
  85. package/dist/{shared-CwGpPheR.d.ts → shared-U405h52W.d.ts} +1 -1
  86. package/dist/{simulate-FGXKIH7V.js → simulate-VT437EEL.js} +2 -2
  87. package/dist/spatial/index.cjs +682 -0
  88. package/dist/spatial/index.d.cts +517 -0
  89. package/dist/spatial/index.d.ts +517 -0
  90. package/dist/spatial/index.js +633 -0
  91. package/dist/{test-PT44BSYG.js → test-4WTX6RKQ.js} +2 -2
  92. package/dist/types.cjs +18 -0
  93. package/dist/types.d.cts +370 -0
  94. package/dist/types.d.ts +370 -0
  95. package/dist/types.js +0 -0
  96. package/dist/{validate-Q5O5TGLT.js → validate-M52DX22Y.js} +1 -1
  97. package/dist/{world-V52ZMH26.js → world-O4HTQPDP.js} +1 -1
  98. package/dist/{world-loader-C4D3VPP3.js → world-loader-YTYFOP7D.js} +1 -1
  99. package/dist/worlds/mentraos-spatial.nv-world.md +68 -0
  100. package/package.json +46 -3
  101. package/dist/{behavioral-SPWPGYXL.js → behavioral-SLW7ALEK.js} +3 -3
  102. package/dist/{bootstrap-IP5QMC3Q.js → bootstrap-2OW5ZLBL.js} +3 -3
  103. package/dist/{chunk-7QIAF377.js → chunk-CYDMUJVZ.js} +0 -0
  104. package/dist/{chunk-QZ666FCV.js → chunk-FHXXD2TI.js} +6 -6
  105. package/dist/{configure-ai-5MP5DWTT.js → configure-ai-LL3VAPQW.js} +3 -3
@@ -1,4 +1,5 @@
1
- import { W as WorldDefinition, G as GuardEvent, a as GuardVerdict } from '../guard-contract-CLBbTGK_.cjs';
1
+ import { G as GuardEvent, a as GuardVerdict } from '../guard-contract-C991HDZp.cjs';
2
+ import { WorldDefinition } from '../types.cjs';
2
3
 
3
4
  /**
4
5
  * Autoresearch Adapter — Bridge between NeuroVerse governance and autoresearch loops
@@ -1,4 +1,5 @@
1
- import { W as WorldDefinition, G as GuardEvent, a as GuardVerdict } from '../guard-contract-CLBbTGK_.js';
1
+ import { G as GuardEvent, a as GuardVerdict } from '../guard-contract-hHjTTjtR.js';
2
+ import { WorldDefinition } from '../types.js';
2
3
 
3
4
  /**
4
5
  * Autoresearch Adapter — Bridge between NeuroVerse governance and autoresearch loops
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  AutoresearchGovernor,
3
3
  createAutoresearchGovernor
4
- } from "../chunk-YNYCQECH.js";
4
+ } from "../chunk-QMVQ6KPL.js";
5
5
  import "../chunk-ZAF6JH23.js";
6
+ import "../chunk-I4RTIMLX.js";
6
7
  import "../chunk-QLPTHTVB.js";
7
- import "../chunk-BXLTEUS4.js";
8
8
  import "../chunk-QWGCMQQD.js";
9
9
  export {
10
10
  AutoresearchGovernor,
@@ -1,5 +1,6 @@
1
- import { b as GuardEngineOptions, P as PlanDefinition, W as WorldDefinition, a as GuardVerdict, G as GuardEvent, c as PlanProgress } from '../guard-contract-CLBbTGK_.cjs';
2
- import { G as GovernanceBlockedError$1 } from '../shared-BGzmYP5g.cjs';
1
+ import { b as GuardEngineOptions, P as PlanDefinition, a as GuardVerdict, G as GuardEvent, c as PlanProgress } from '../guard-contract-C991HDZp.cjs';
2
+ import { WorldDefinition } from '../types.cjs';
3
+ import { G as GovernanceBlockedError$1 } from '../shared-DGnn1jiS.cjs';
3
4
 
4
5
  /**
5
6
  * Centralized Tool Classification & Risk Pattern Detection
@@ -1,5 +1,6 @@
1
- import { b as GuardEngineOptions, P as PlanDefinition, W as WorldDefinition, a as GuardVerdict, G as GuardEvent, c as PlanProgress } from '../guard-contract-CLBbTGK_.js';
2
- import { G as GovernanceBlockedError$1 } from '../shared-CwGpPheR.js';
1
+ import { b as GuardEngineOptions, P as PlanDefinition, a as GuardVerdict, G as GuardEvent, c as PlanProgress } from '../guard-contract-hHjTTjtR.js';
2
+ import { WorldDefinition } from '../types.js';
3
+ import { G as GovernanceBlockedError$1 } from '../shared-U405h52W.js';
3
4
 
4
5
  /**
5
6
  * Centralized Tool Classification & Risk Pattern Detection
@@ -3,11 +3,11 @@ import {
3
3
  GovernanceBlockedError,
4
4
  createDeepAgentsGuard,
5
5
  createDeepAgentsGuardFromWorld
6
- } from "../chunk-DWHUZUEY.js";
6
+ } from "../chunk-YJ34R5NB.js";
7
7
  import "../chunk-5U2MQO5P.js";
8
8
  import "../chunk-ZAF6JH23.js";
9
+ import "../chunk-I4RTIMLX.js";
9
10
  import "../chunk-QLPTHTVB.js";
10
- import "../chunk-BXLTEUS4.js";
11
11
  import "../chunk-QWGCMQQD.js";
12
12
  export {
13
13
  DeepAgentsGuard,
@@ -1,4 +1,5 @@
1
- import { a as GuardVerdict, G as GuardEvent, W as WorldDefinition } from '../guard-contract-CLBbTGK_.cjs';
1
+ import { a as GuardVerdict, G as GuardEvent } from '../guard-contract-C991HDZp.cjs';
2
+ import { WorldDefinition } from '../types.cjs';
2
3
 
3
4
  /**
4
5
  * NeuroVerse Adapter — Express / Fastify
@@ -1,4 +1,5 @@
1
- import { a as GuardVerdict, G as GuardEvent, W as WorldDefinition } from '../guard-contract-CLBbTGK_.js';
1
+ import { a as GuardVerdict, G as GuardEvent } from '../guard-contract-hHjTTjtR.js';
2
+ import { WorldDefinition } from '../types.js';
2
3
 
3
4
  /**
4
5
  * NeuroVerse Adapter — Express / Fastify
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createGovernanceMiddleware,
3
3
  createGovernanceMiddlewareFromWorld
4
- } from "../chunk-25XHSTPT.js";
4
+ } from "../chunk-RDA7ISWC.js";
5
5
  import "../chunk-ZAF6JH23.js";
6
+ import "../chunk-I4RTIMLX.js";
6
7
  import "../chunk-QLPTHTVB.js";
7
- import "../chunk-BXLTEUS4.js";
8
8
  import "../chunk-QWGCMQQD.js";
9
9
  export {
10
10
  createGovernanceMiddleware,
@@ -2779,6 +2779,7 @@ var MentraGovernedExecutor = class {
2779
2779
  _userRules;
2780
2780
  _emergencyOverride = false;
2781
2781
  _emergencyActivatedAt = null;
2782
+ _spatialSession = null;
2782
2783
  constructor(world, options = {}, userRules = DEFAULT_USER_RULES) {
2783
2784
  this.world = world;
2784
2785
  this.options = options;
@@ -2835,13 +2836,36 @@ var MentraGovernedExecutor = class {
2835
2836
  get emergencyActivatedAt() {
2836
2837
  return this._emergencyActivatedAt;
2837
2838
  }
2839
+ // ── Spatial Governance (optional) ────────────────────────────────────────
2840
+ /**
2841
+ * Attach a spatial session to this executor.
2842
+ *
2843
+ * When attached, intents are evaluated against the spatial context
2844
+ * (zone rules + handshake rules) AFTER user rules but BEFORE
2845
+ * hardware and platform checks. This is Layer 1.5.
2846
+ *
2847
+ * Pass null to detach (e.g., when leaving a zone).
2848
+ */
2849
+ setSpatialSession(session) {
2850
+ this._spatialSession = session;
2851
+ }
2852
+ /** Whether a spatial session is currently active */
2853
+ get hasSpatialSession() {
2854
+ return this._spatialSession !== null;
2855
+ }
2856
+ /** Get the current spatial session description */
2857
+ get spatialDescription() {
2858
+ return this._spatialSession?.description ?? null;
2859
+ }
2838
2860
  /**
2839
2861
  * Evaluate an intent against user rules + platform world.
2840
2862
  *
2841
2863
  * Three-layer evaluation:
2842
- * 0. Emergency override — if active, skip governance (layers 1 + 3),
2864
+ * 0. Emergency override — if active, skip governance (layers 1 + 1.5 + 3),
2843
2865
  * but STILL enforce platform constraints (layer 2)
2844
2866
  * 1. User rules check — personal governance override, can BLOCK or PAUSE
2867
+ * 1.5. Spatial governance — zone + handshake rules (optional, temporary)
2868
+ * ↑ ONLY ACTIVE when a spatial session is attached
2845
2869
  * 2. Hardware capability check — validates glasses support
2846
2870
  * ↑ THIS IS A PLATFORM CONSTRAINT — never overridden
2847
2871
  * 3. Platform guard engine — full world rule evaluation
@@ -2872,6 +2896,47 @@ var MentraGovernedExecutor = class {
2872
2896
  return result2;
2873
2897
  }
2874
2898
  }
2899
+ if (!this._emergencyOverride && this._spatialSession) {
2900
+ const spatialResult = this._spatialSession.evaluate(intent);
2901
+ if (!spatialResult.allowed && !spatialResult.requiresConfirmation) {
2902
+ const verdict2 = {
2903
+ status: "BLOCK",
2904
+ ruleId: "spatial-zone-rule",
2905
+ reason: spatialResult.reason,
2906
+ evidence: makeEvidence("spatial-zone-rule")
2907
+ };
2908
+ const result2 = {
2909
+ allowed: false,
2910
+ requiresConfirmation: false,
2911
+ verdict: verdict2,
2912
+ intentDef,
2913
+ appContext,
2914
+ decidingLayer: "spatial"
2915
+ };
2916
+ this.options.onBlock?.(result2);
2917
+ this.options.onEvaluate?.(result2);
2918
+ return result2;
2919
+ }
2920
+ if (spatialResult.requiresConfirmation) {
2921
+ const verdict2 = {
2922
+ status: "PAUSE",
2923
+ ruleId: "spatial-zone-rule",
2924
+ reason: spatialResult.reason,
2925
+ evidence: makeEvidence("spatial-zone-rule")
2926
+ };
2927
+ const result2 = {
2928
+ allowed: false,
2929
+ requiresConfirmation: true,
2930
+ verdict: verdict2,
2931
+ intentDef,
2932
+ appContext,
2933
+ decidingLayer: "spatial"
2934
+ };
2935
+ this.options.onPause?.(result2);
2936
+ this.options.onEvaluate?.(result2);
2937
+ return result2;
2938
+ }
2939
+ }
2875
2940
  if (intentDef && glassesModel && !intentDef.supported_glasses.includes(glassesModel)) {
2876
2941
  const verdict2 = {
2877
2942
  status: "BLOCK",
@@ -1,284 +1,10 @@
1
- export { B as BaseAdapterOptions, G as GovernanceBlockedError, G as MentraGovernanceBlockedError, P as PlanTrackingCallbacks, a as PlanTrackingState, b as buildEngineOptions, d as defaultBlockMessage, e as extractScope, t as trackPlanProgress } from '../shared-BGzmYP5g.cjs';
1
+ export { B as BaseAdapterOptions, G as GovernanceBlockedError, G as MentraGovernanceBlockedError, P as PlanTrackingCallbacks, a as PlanTrackingState, b as buildEngineOptions, d as defaultBlockMessage, e as extractScope, t as trackPlanProgress } from '../shared-DGnn1jiS.cjs';
2
2
  export { GovernanceBlockedError as LangChainGovernanceBlockedError, NeuroVerseCallbackHandler, NeuroVerseHandlerOptions, createNeuroVerseCallbackHandler, createNeuroVerseCallbackHandlerFromWorld } from './langchain.cjs';
3
3
  export { GovernedExecutorOptions, GovernedToolExecutor, GovernedToolResult, GovernanceBlockedError as OpenAIGovernanceBlockedError, OpenAIToolCall, createGovernedToolExecutor, createGovernedToolExecutorFromWorld } from './openai.cjs';
4
4
  export { AgentAction, HookResult, NeuroVersePlugin, NeuroVersePluginOptions, GovernanceBlockedError as OpenClawGovernanceBlockedError, createNeuroVersePlugin, createNeuroVersePluginFromWorld } from './openclaw.cjs';
5
5
  export { GovernanceMiddlewareOptions, GovernanceRequest, GovernanceResponse, createGovernanceMiddleware, createGovernanceMiddlewareFromWorld } from './express.cjs';
6
6
  export { AutoresearchGovernor, AutoresearchGovernorConfig, ExperimentProposal, ExperimentResult, ResearchState } from './autoresearch.cjs';
7
7
  export { GovernanceBlockedError as DeepAgentsGovernanceBlockedError, DeepAgentsGuard, DeepAgentsGuardOptions, DeepAgentsGuardResult, DeepAgentsToolCall, DeepAgentsToolCategory, createDeepAgentsGuard, createDeepAgentsGuardFromWorld } from './deep-agents.cjs';
8
- import { a as GuardVerdict, P as PlanDefinition, c as PlanProgress, W as WorldDefinition } from '../guard-contract-CLBbTGK_.cjs';
9
-
10
- /**
11
- * MentraOS Intent Taxonomy — Canonical Intent-to-SDK Mapping
12
- *
13
- * This is the contract between NeuroVerse governance and the MentraOS platform.
14
- * Every user action that touches hardware, data, AI processing, or session
15
- * state must map to exactly one intent in this taxonomy. The guard engine
16
- * evaluates intents, not natural language.
17
- *
18
- * Two categories of intents:
19
- * 1. Hardware intents — SDK methods that access glasses hardware
20
- * 2. AI interaction intents — data flows to AI APIs, AI actions on
21
- * behalf of the user, AI data retention decisions
22
- *
23
- * Flow:
24
- * User speech → classifyIntentWithAI(knownIntents) → MentraIntent
25
- * → evaluateGuard(event, world) → verdict → MentraOS SDK call (or block)
26
- *
27
- * Design rules:
28
- * - One intent per SDK method or AI action type. No ambiguity.
29
- * - Intent names are snake_case, prefixed by domain.
30
- * - Every intent declares which MentraOS permission it requires.
31
- * - Every intent declares which glasses support it.
32
- * - AI intents use 'NONE' permission (they operate at the app server layer).
33
- * - The taxonomy is the single source of truth for governance coverage.
34
- */
35
- interface MentraIntentDefinition {
36
- /** Canonical intent identifier (e.g., "camera_photo_capture") */
37
- intent: string;
38
- /** Human-readable description of what this intent does */
39
- description: string;
40
- /** MentraOS SDK method(s) this maps to */
41
- sdk_method: string;
42
- /** MentraOS permission required (from app_config.json) */
43
- permission: MentraPermission;
44
- /** Hardware domain this intent belongs to */
45
- domain: MentraDomain;
46
- /** Which glasses models support this capability */
47
- supported_glasses: GlassesModel[];
48
- /** Governance tool category for guard engine classification */
49
- action_category: 'read' | 'write' | 'delete' | 'network' | 'shell' | 'browser' | 'other';
50
- /** Risk level baseline (can be elevated by spatial context) */
51
- base_risk: 'low' | 'medium' | 'high' | 'critical';
52
- /** Whether the action produces data that leaves the device boundary */
53
- exfiltration_risk: boolean;
54
- /** Whether the action is reversible */
55
- reversible: boolean;
56
- }
57
- type MentraPermission = 'CAMERA' | 'MICROPHONE' | 'LOCATION' | 'CALENDAR' | 'READ_NOTIFICATIONS' | 'NONE';
58
- type MentraDomain = 'camera' | 'microphone' | 'display' | 'location' | 'calendar' | 'notifications' | 'session' | 'dashboard' | 'audio' | 'tool_call' | 'ai_data' | 'ai_action';
59
- type GlassesModel = 'even_realities_g1' | 'mentra_live' | 'mentra_mach1' | 'vuzix_z100';
60
- declare const MENTRA_INTENT_TAXONOMY: MentraIntentDefinition[];
61
- /** All canonical intent strings for use with classifyIntentWithAI() */
62
- declare const MENTRA_KNOWN_INTENTS: string[];
63
- /** Get the definition for an intent, or undefined if unknown */
64
- declare function getMentraIntent(intent: string): MentraIntentDefinition | undefined;
65
- /** Get all intents that require a specific permission */
66
- declare function getIntentsByPermission(permission: MentraPermission): MentraIntentDefinition[];
67
- /** Get all intents supported by a specific glasses model */
68
- declare function getIntentsByGlasses(model: GlassesModel): MentraIntentDefinition[];
69
- /** Check if an intent is supported on a given glasses model */
70
- declare function isIntentSupported(intent: string, model: GlassesModel): boolean;
71
- /** Get all high-risk or critical intents */
72
- declare function getHighRiskIntents(): MentraIntentDefinition[];
73
- /** Get all intents with exfiltration risk */
74
- declare function getExfiltrationIntents(): MentraIntentDefinition[];
75
- /** Get all AI data flow intents (data sent to AI APIs) */
76
- declare function getAIDataIntents(): MentraIntentDefinition[];
77
- /** Get all AI action intents (actions AI takes on user's behalf) */
78
- declare function getAIActionIntents(): MentraIntentDefinition[];
79
- /** Get all AI-related intents (data + actions) */
80
- declare function getAIIntents(): MentraIntentDefinition[];
81
- /** Check if an intent is an AI interaction intent */
82
- declare function isAIIntent(intent: string): boolean;
83
-
84
- /**
85
- * NeuroVerse Adapter — MentraOS Smart Glasses
86
- *
87
- * The boundary layer between NeuroVerse governance and MentraOS SDK.
88
- *
89
- * This adapter provides two governance layers:
90
- * 1. Platform Governance — enforces hardware permissions, session isolation,
91
- * AI data flow declarations, and AI action confirmation requirements
92
- * 2. User Rules Override — enforces the user's personal governance preferences
93
- * across ALL apps. User rules always win.
94
- *
95
- * Architecture:
96
- * App receives user data (transcription, camera, location)
97
- * → App wants to send data to AI API or take action
98
- * → MentraGovernedExecutor.evaluate(intent, appContext)
99
- * → Layer 1: User rules check (overrides everything)
100
- * → Layer 2: Hardware capability check (physics — never overridden)
101
- * → Layer 3: Platform guard engine (world rules)
102
- * → verdict: ALLOW / BLOCK / PAUSE
103
- *
104
- * The adapter sits at:
105
- * App Server → NeuroVerse Guard → MentraOS SDK → Hardware
106
- * → NeuroVerse Guard → AI API call (or block)
107
- *
108
- * Usage:
109
- * import { createMentraGovernedExecutor } from '@neuroverseos/governance/adapters/mentraos';
110
- *
111
- * const executor = await createMentraGovernedExecutor('./world/');
112
- * const result = executor.evaluate('ai_send_transcription', appContext);
113
- */
114
-
115
- /**
116
- * Context for the current app session.
117
- * This replaces the old SpatialContext — grounded in real app data,
118
- * not hypothetical spatial tech.
119
- */
120
- interface AppContext {
121
- /** The app's unique identifier from console.mentra.glass */
122
- appId: string;
123
- /** Whether the app declared its AI provider(s) at registration */
124
- aiProviderDeclared: boolean;
125
- /** List of AI API providers the app declared (e.g., ['openai', 'anthropic']) */
126
- declaredAIProviders: string[];
127
- /** Whether the user has opted in to data retention for this app */
128
- dataRetentionOptedIn: boolean;
129
- /** Number of distinct data types the app has sent to AI this session */
130
- aiDataTypesSent: number;
131
- /** Connected glasses model */
132
- glassesModel?: GlassesModel;
133
- }
134
- /**
135
- * User's personal governance preferences.
136
- * These override EVERY app's behavior. The user is king.
137
- *
138
- * In production, these are loaded from the user's profile on the MentraOS phone app.
139
- * The user sets them once, and they apply across all apps.
140
- */
141
- interface UserRules {
142
- /**
143
- * AI data send policy.
144
- * - 'declared_only': AI data sends allowed only to declared providers (default)
145
- * - 'confirm_each': Every AI data send requires user confirmation
146
- * - 'block_all': No AI data sends allowed (offline-only mode)
147
- */
148
- aiDataPolicy: 'declared_only' | 'confirm_each' | 'block_all';
149
- /**
150
- * AI auto-action policy.
151
- * - 'confirm_all': Every AI action must be confirmed on display (default)
152
- * - 'allow_low_risk': Low-risk actions (display, read) auto-allowed; high-risk confirmed
153
- * - 'block_all': No AI actions allowed
154
- */
155
- aiActionPolicy: 'confirm_all' | 'allow_low_risk' | 'block_all';
156
- /**
157
- * AI purchase policy.
158
- * - 'confirm_each': Per-transaction confirmation required (default)
159
- * - 'block_all': No AI purchases allowed
160
- */
161
- aiPurchasePolicy: 'confirm_each' | 'block_all';
162
- /**
163
- * AI messaging policy.
164
- * - 'confirm_each': Per-message confirmation required (default)
165
- * - 'block_all': No AI messaging allowed
166
- */
167
- aiMessagingPolicy: 'confirm_each' | 'block_all';
168
- /**
169
- * Data retention policy.
170
- * - 'app_declared': Allow retention if app declared it and user opted in (default)
171
- * - 'never': No data retention, ever
172
- */
173
- dataRetentionPolicy: 'app_declared' | 'never';
174
- /**
175
- * Maximum number of AI providers receiving data simultaneously.
176
- * Default: 5. Set to 1 for single-provider mode.
177
- */
178
- maxAIProviders: number;
179
- }
180
- /** Default user rules — reasonable defaults, not paranoid, not permissive */
181
- declare const DEFAULT_USER_RULES: UserRules;
182
- /**
183
- * Evaluate an intent against the user's personal rules.
184
- * Returns null if the user rules don't apply to this intent.
185
- * Returns a block verdict if the user rules block it.
186
- * Returns a pause verdict if the user rules require confirmation.
187
- */
188
- declare function evaluateUserRules(intent: string, rules: UserRules, appContext: AppContext): {
189
- verdict: GuardVerdict;
190
- reason: string;
191
- } | null;
192
- interface MentraGuardResult {
193
- /** Whether the action is allowed */
194
- allowed: boolean;
195
- /** Whether the action requires user confirmation (PAUSE) */
196
- requiresConfirmation: boolean;
197
- /** The governance verdict */
198
- verdict: GuardVerdict;
199
- /** The resolved intent definition (if found in taxonomy) */
200
- intentDef?: MentraIntentDefinition;
201
- /** User rules check result (if applicable) */
202
- userRulesResult?: {
203
- reason: string;
204
- };
205
- /** The app context used for evaluation */
206
- appContext: AppContext;
207
- /** Which governance layer produced this verdict */
208
- decidingLayer: 'user_rules' | 'hardware' | 'platform' | 'emergency_override';
209
- }
210
- interface MentraExecutorOptions {
211
- /** Include full evaluation trace in verdicts. Default: false. */
212
- trace?: boolean;
213
- /** Enforcement level override. */
214
- level?: 'basic' | 'standard' | 'strict';
215
- /** Called when an action is blocked. */
216
- onBlock?: (result: MentraGuardResult) => void;
217
- /** Called when an action requires confirmation. */
218
- onPause?: (result: MentraGuardResult) => void;
219
- /** Called for every evaluation. */
220
- onEvaluate?: (result: MentraGuardResult) => void;
221
- /** Plan to enforce. */
222
- plan?: PlanDefinition;
223
- /** Plan progress callbacks. */
224
- onPlanProgress?: (progress: PlanProgress) => void;
225
- onPlanComplete?: () => void;
226
- }
227
- declare class MentraGovernedExecutor {
228
- private world;
229
- private engineOptions;
230
- private options;
231
- private planState;
232
- private planCallbacks;
233
- private _userRules;
234
- private _emergencyOverride;
235
- private _emergencyActivatedAt;
236
- constructor(world: WorldDefinition, options?: MentraExecutorOptions, userRules?: UserRules);
237
- /** Get the current user rules */
238
- get userRules(): UserRules;
239
- /** Update user rules at runtime (e.g., user changes preferences in phone app) */
240
- updateUserRules(rules: Partial<UserRules>): void;
241
- /**
242
- * Activate emergency override — user is king.
243
- *
244
- * Bypasses all NeuroVerse governance rules (user rules, platform rules).
245
- * Does NOT bypass MentraOS platform constraints (hardware capability,
246
- * declared permissions, session isolation). You can't override physics.
247
- *
248
- * Returns the timestamp of activation for audit trail.
249
- */
250
- activateEmergencyOverride(): number;
251
- /**
252
- * Deactivate emergency override — governance resumes.
253
- * Returns the duration the override was active (ms).
254
- */
255
- deactivateEmergencyOverride(): number;
256
- /** Whether emergency override is currently active */
257
- get isEmergencyOverrideActive(): boolean;
258
- /** Timestamp when emergency override was activated, or null */
259
- get emergencyActivatedAt(): number | null;
260
- /**
261
- * Evaluate an intent against user rules + platform world.
262
- *
263
- * Three-layer evaluation:
264
- * 0. Emergency override — if active, skip governance (layers 1 + 3),
265
- * but STILL enforce platform constraints (layer 2)
266
- * 1. User rules check — personal governance override, can BLOCK or PAUSE
267
- * 2. Hardware capability check — validates glasses support
268
- * ↑ THIS IS A PLATFORM CONSTRAINT — never overridden
269
- * 3. Platform guard engine — full world rule evaluation
270
- */
271
- evaluate(intent: string, appContext: AppContext): MentraGuardResult;
272
- /** Get all known intents for this adapter */
273
- get knownIntents(): string[];
274
- }
275
- /**
276
- * Create a MentraOS governed executor from a world directory path.
277
- */
278
- declare function createMentraGovernedExecutor(worldPath: string, options?: MentraExecutorOptions, userRules?: UserRules): Promise<MentraGovernedExecutor>;
279
- /**
280
- * Create a MentraOS governed executor from an already-loaded WorldDefinition.
281
- */
282
- declare function createMentraGovernedExecutorFromWorld(world: WorldDefinition, options?: MentraExecutorOptions, userRules?: UserRules): MentraGovernedExecutor;
283
-
284
- export { type AppContext, DEFAULT_USER_RULES, type GlassesModel, MENTRA_INTENT_TAXONOMY, MENTRA_KNOWN_INTENTS, type MentraDomain, type MentraExecutorOptions, MentraGovernedExecutor, type MentraGuardResult, type MentraIntentDefinition, type MentraPermission, type UserRules, createMentraGovernedExecutor, createMentraGovernedExecutorFromWorld, evaluateUserRules, getAIActionIntents, getAIDataIntents, getAIIntents, getExfiltrationIntents, getHighRiskIntents, getIntentsByGlasses, getIntentsByPermission, getMentraIntent, isAIIntent, isIntentSupported };
8
+ export { AppContext, DEFAULT_USER_RULES, GlassesModel, MENTRA_INTENT_TAXONOMY, MENTRA_KNOWN_INTENTS, MentraDomain, MentraExecutorOptions, MentraGovernedExecutor, MentraGuardResult, MentraIntentDefinition, MentraPermission, UserRules, createMentraGovernedExecutor, createMentraGovernedExecutorFromWorld, evaluateUserRules, getAIActionIntents, getAIDataIntents, getAIIntents, getExfiltrationIntents, getHighRiskIntents, getIntentsByGlasses, getIntentsByPermission, getMentraIntent, isAIIntent, isIntentSupported } from './mentraos.cjs';
9
+ import '../guard-contract-C991HDZp.cjs';
10
+ import '../types.cjs';