@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
@@ -0,0 +1,370 @@
1
+ /**
2
+ * World Engine Types — Subset for Governance Engine
3
+ *
4
+ * These types map to the .nv-world.zip file format.
5
+ * This file contains only the types referenced by the governance
6
+ * engine (guard, validate, bootstrap). The full type system lives
7
+ * in the main NeuroVerse OS repo.
8
+ */
9
+ interface ModelIdentity {
10
+ modelName: string;
11
+ acronymExpansion?: string;
12
+ nameType: 'acronym' | 'metaphor';
13
+ purpose: string;
14
+ domain?: string;
15
+ }
16
+ interface WorldIdentity {
17
+ world_id: string;
18
+ name: string;
19
+ thesis: string;
20
+ version: string;
21
+ runtime_mode: 'SIMULATION' | 'NARRATIVE' | 'COMPLIANCE' | 'CUSTOM';
22
+ default_assumption_profile: string;
23
+ default_alternative_profile: string;
24
+ modules: string[];
25
+ players: {
26
+ thinking_space: boolean;
27
+ experience_space: boolean;
28
+ action_space: boolean;
29
+ };
30
+ modelIdentity?: ModelIdentity;
31
+ }
32
+ interface Invariant {
33
+ id: string;
34
+ label: string;
35
+ enforcement: 'structural' | 'prompt';
36
+ mutable: false;
37
+ }
38
+ interface AssumptionProfile {
39
+ name: string;
40
+ description: string;
41
+ is_default_baseline?: boolean;
42
+ is_default_alternative?: boolean;
43
+ parameters: Record<string, string>;
44
+ }
45
+ interface ParameterDefinition {
46
+ type: 'enum' | 'number' | 'boolean';
47
+ options?: string[];
48
+ min?: number;
49
+ max?: number;
50
+ label: string;
51
+ description: string;
52
+ }
53
+ interface AssumptionConfig {
54
+ profiles: Record<string, AssumptionProfile>;
55
+ parameter_definitions: Record<string, ParameterDefinition>;
56
+ }
57
+ interface StateVariable {
58
+ type: 'enum' | 'number' | 'boolean';
59
+ options?: string[];
60
+ min?: number;
61
+ max?: number;
62
+ step?: number;
63
+ default: string | number | boolean;
64
+ mutable: boolean;
65
+ label: string;
66
+ description: string;
67
+ display_as?: 'percentage' | 'integer' | 'decimal';
68
+ }
69
+ interface StatePreset {
70
+ description: string;
71
+ values: Record<string, string | number | boolean>;
72
+ }
73
+ interface StateSchema {
74
+ variables: Record<string, StateVariable>;
75
+ presets: Record<string, StatePreset>;
76
+ }
77
+ type TriggerOperator = '==' | '!=' | '>' | '<' | '>=' | '<=' | 'in';
78
+ type EffectOperation = 'multiply' | 'add' | 'subtract' | 'set' | 'set_boolean' | 'multiply_dynamic' | 'add_dynamic' | 'subtract_dynamic' | 'set_dynamic';
79
+ type RuleSeverity = 'structural' | 'degradation' | 'advantage';
80
+ interface Trigger {
81
+ field: string;
82
+ operator: TriggerOperator;
83
+ value: string | number | boolean | string[];
84
+ source: 'state' | 'assumption';
85
+ }
86
+ interface Effect {
87
+ target: string;
88
+ operation: EffectOperation;
89
+ value: number | boolean | string;
90
+ value_formula?: string;
91
+ }
92
+ interface CollapseCheck {
93
+ field: string;
94
+ operator: TriggerOperator;
95
+ value: number;
96
+ result: 'MODEL_COLLAPSES';
97
+ }
98
+ interface ConditionalEffect {
99
+ condition: Trigger;
100
+ and?: Trigger;
101
+ or?: Trigger;
102
+ condition_any?: Trigger[];
103
+ effects: Effect[];
104
+ }
105
+ interface CausalTranslation {
106
+ trigger_text: string;
107
+ rule_text: string;
108
+ shift_text: string;
109
+ effect_text: string;
110
+ }
111
+ interface RuleRedirect {
112
+ suggested_action: string;
113
+ reason: string;
114
+ fallback_state_changes?: Record<string, string | number | boolean>;
115
+ }
116
+ interface Rule {
117
+ id: string;
118
+ severity: RuleSeverity;
119
+ label: string;
120
+ description: string;
121
+ order: number;
122
+ triggers: Trigger[];
123
+ effects?: Effect[];
124
+ effects_conditional?: ConditionalEffect[];
125
+ collapse_check?: CollapseCheck;
126
+ secondary_check?: CollapseCheck;
127
+ exclusive_with?: string;
128
+ causal_translation: CausalTranslation;
129
+ redirect?: RuleRedirect;
130
+ }
131
+ type ViabilityStatus = 'THRIVING' | 'STABLE' | 'COMPRESSED' | 'CRITICAL' | 'MODEL_COLLAPSES';
132
+ interface ViabilityGate {
133
+ status: ViabilityStatus;
134
+ field: string;
135
+ operator: TriggerOperator;
136
+ value: number;
137
+ color: string;
138
+ icon: string;
139
+ }
140
+ interface CollapseVisual {
141
+ background: string;
142
+ text: string;
143
+ border: string;
144
+ label: string;
145
+ }
146
+ interface GatesConfig {
147
+ viability_classification: ViabilityGate[];
148
+ structural_override: {
149
+ description: string;
150
+ enforcement: 'mandatory';
151
+ };
152
+ sustainability_threshold: number;
153
+ collapse_visual: CollapseVisual;
154
+ }
155
+ interface ComputedOutcome {
156
+ id: string;
157
+ type: 'number' | 'boolean' | 'enum';
158
+ range?: [number, number];
159
+ options?: string[];
160
+ default?: number | boolean | string;
161
+ display_as?: 'percentage' | 'integer' | 'decimal';
162
+ label: string;
163
+ primary?: boolean;
164
+ initial_value?: string;
165
+ derived_from?: string;
166
+ assignment?: 'rule' | 'external';
167
+ show_in_comparison: boolean;
168
+ structural_indicator?: boolean;
169
+ }
170
+ interface ComparisonLayout {
171
+ primary_card: string;
172
+ status_badge: string;
173
+ structural_indicators: string[];
174
+ }
175
+ interface OutcomesConfig {
176
+ computed_outcomes: ComputedOutcome[];
177
+ comparison_layout: ComparisonLayout;
178
+ }
179
+ interface WorldMetadata {
180
+ format_version: string;
181
+ created_at: string;
182
+ last_modified: string;
183
+ authoring_method: 'manual-authoring' | 'configurator-ai' | 'migration';
184
+ integrity_hash?: string;
185
+ }
186
+ interface KernelConfig {
187
+ artifact_type: string;
188
+ kernel_id: string;
189
+ version: string;
190
+ domain: string;
191
+ enforcement_level: 'standard' | 'strict' | 'permissive';
192
+ input_boundaries: {
193
+ forbidden_patterns: Array<{
194
+ id: string;
195
+ pattern: string;
196
+ reason: string;
197
+ action: 'BLOCK' | 'WARN';
198
+ }>;
199
+ };
200
+ output_boundaries: {
201
+ forbidden_patterns: Array<{
202
+ id: string;
203
+ pattern: string;
204
+ reason: string;
205
+ action: 'BLOCK' | 'WARN';
206
+ }>;
207
+ };
208
+ response_vocabulary: Record<string, string>;
209
+ metadata: {
210
+ compiled_by: string;
211
+ compiled_at: string;
212
+ source_hash: string;
213
+ compiler_version: string;
214
+ };
215
+ }
216
+ type RoleArchetype = 'observer' | 'operator' | 'strategist' | 'guardian' | 'steward' | 'executor';
217
+ type RoleAuthority = 'none' | 'execute_within_limits' | 'reprioritize_within_bounds' | 'block_violations' | 'escalate_audit_freeze' | 'execute_declared_actions';
218
+ type RolePosture = 'analyze' | 'task_oriented' | 'long_term_coherence' | 'constraint_aware' | 'system_integrity' | 'efficient';
219
+ interface WorldRoleDefinition {
220
+ id: string;
221
+ archetype: RoleArchetype;
222
+ authority: RoleAuthority;
223
+ posture: RolePosture;
224
+ name: string;
225
+ description: string;
226
+ icon?: string;
227
+ roleMandate: string;
228
+ voiceStyle?: string;
229
+ canDo: string[];
230
+ cannotDo: string[];
231
+ requiresApproval?: boolean;
232
+ trackedOutcomes?: string[];
233
+ ownedRules?: string[];
234
+ /** Default lens for this role (references a lens id from the world's lenses config) */
235
+ defaultLens?: string;
236
+ }
237
+ type RoleAssignment = 'dynamic' | 'per_session' | 'permanent';
238
+ interface RoleTransition {
239
+ from: string;
240
+ to: string;
241
+ initiator: 'self' | 'steward' | 'any';
242
+ condition?: string;
243
+ }
244
+ interface RolesConfig {
245
+ assignment: RoleAssignment;
246
+ roles: WorldRoleDefinition[];
247
+ transitions?: RoleTransition[];
248
+ }
249
+ interface Guard {
250
+ id: string;
251
+ label: string;
252
+ description: string;
253
+ category: 'structural' | 'operational' | 'advisory';
254
+ enforcement: 'block' | 'pause' | 'warn' | 'modify' | 'penalize' | 'reward' | 'neutral';
255
+ immutable: boolean;
256
+ invariant_ref?: string;
257
+ intent_patterns: string[];
258
+ required_roles?: string[];
259
+ redirect?: string;
260
+ default_enabled?: boolean;
261
+ /** Tool names this guard applies to (case-insensitive). Empty/absent = all tools. */
262
+ appliesTo?: string[];
263
+ player_modes?: {
264
+ thinking?: 'annotate' | 'block' | 'ignore';
265
+ experience?: 'simulate' | 'score' | 'ignore';
266
+ action?: 'block' | 'pause' | 'warn' | 'modify' | 'penalize' | 'reward' | 'neutral';
267
+ };
268
+ /** Consequence to apply when enforcement is 'penalize' */
269
+ consequence?: {
270
+ type: 'freeze' | 'reduce_influence' | 'increase_risk' | 'cooldown' | 'custom';
271
+ rounds?: number;
272
+ magnitude?: number;
273
+ description: string;
274
+ };
275
+ /** Reward to apply when enforcement is 'reward' */
276
+ reward?: {
277
+ type: 'boost_influence' | 'priority' | 'faster_execution' | 'weight_increase' | 'custom';
278
+ rounds?: number;
279
+ magnitude?: number;
280
+ description: string;
281
+ };
282
+ /** For 'modify' enforcement: what the action should be changed to */
283
+ modify_to?: string;
284
+ }
285
+ interface IntentPattern {
286
+ label: string;
287
+ pattern: string;
288
+ }
289
+ interface GuardsConfig {
290
+ guards: Guard[];
291
+ intent_vocabulary: Record<string, IntentPattern>;
292
+ /** All known action surfaces (e.g. "shell", "http", "db", "email", "deploy").
293
+ * When declared, the validator checks that every surface has at least one
294
+ * governing guard — surfaces without guards are reported as fail-open. */
295
+ tool_surfaces?: string[];
296
+ }
297
+ /**
298
+ * A governance event — the bridge between Guard and Simulate.
299
+ *
300
+ * Guard produces events (what happened).
301
+ * Simulate consumes events (what changes because of it).
302
+ *
303
+ * Events are NOT stored — they flow through the system.
304
+ * Guard evaluation log IS the event stream.
305
+ */
306
+ interface GovernanceEvent {
307
+ /** Semantic event type: "complaint", "refund", "action_blocked", etc. */
308
+ type: string;
309
+ /** Who caused this event */
310
+ actor?: 'customer' | 'agent' | 'system';
311
+ /** Where the event originated */
312
+ source: 'guard' | 'manual' | 'system';
313
+ /** Unix timestamp (ms) */
314
+ timestamp: number;
315
+ /** Guard status that produced this event (when source=guard) */
316
+ guardStatus?: 'ALLOW' | 'BLOCK' | 'PAUSE' | 'MODIFY' | 'PENALIZE' | 'REWARD' | 'NEUTRAL';
317
+ /** Optional metadata */
318
+ metadata?: Record<string, unknown>;
319
+ }
320
+ interface LensDirectiveConfig {
321
+ id: string;
322
+ scope: 'response_framing' | 'language_style' | 'content_filtering' | 'value_emphasis' | 'behavior_shaping';
323
+ instruction: string;
324
+ }
325
+ interface LensConfig {
326
+ id: string;
327
+ name: string;
328
+ tagline: string;
329
+ description: string;
330
+ tags: string[];
331
+ tone: {
332
+ formality: 'casual' | 'neutral' | 'formal' | 'professional';
333
+ verbosity: 'terse' | 'concise' | 'balanced' | 'detailed';
334
+ emotion: 'warm' | 'neutral' | 'reserved' | 'clinical';
335
+ confidence: 'humble' | 'balanced' | 'authoritative' | 'assertive';
336
+ };
337
+ directives: LensDirectiveConfig[];
338
+ defaultForRoles: string[];
339
+ priority: number;
340
+ stackable: boolean;
341
+ }
342
+ interface LensesConfig {
343
+ lenses: LensConfig[];
344
+ /**
345
+ * Lens policy:
346
+ * - 'locked': lenses are assigned by role, user cannot change without pin
347
+ * - 'role_default': lenses start as role default, user can override
348
+ * - 'user_choice': no default, user picks freely
349
+ */
350
+ policy?: 'locked' | 'role_default' | 'user_choice';
351
+ /** Pin required to change lenses when policy is 'locked' */
352
+ lockPin?: string;
353
+ }
354
+ interface WorldDefinition {
355
+ world: WorldIdentity;
356
+ invariants: Invariant[];
357
+ assumptions: AssumptionConfig;
358
+ stateSchema: StateSchema;
359
+ rules: Rule[];
360
+ gates: GatesConfig;
361
+ outcomes: OutcomesConfig;
362
+ guards?: GuardsConfig;
363
+ roles?: RolesConfig;
364
+ kernel?: KernelConfig;
365
+ lenses?: LensesConfig;
366
+ enforcement?: string;
367
+ metadata: WorldMetadata;
368
+ }
369
+
370
+ export type { AssumptionConfig, AssumptionProfile, CausalTranslation, CollapseCheck, CollapseVisual, ComparisonLayout, ComputedOutcome, ConditionalEffect, Effect, EffectOperation, GatesConfig, GovernanceEvent, Guard, GuardsConfig, IntentPattern, Invariant, KernelConfig, LensConfig, LensDirectiveConfig, LensesConfig, ModelIdentity, OutcomesConfig, ParameterDefinition, RoleArchetype, RoleAssignment, RoleAuthority, RolePosture, RoleTransition, RolesConfig, Rule, RuleRedirect, RuleSeverity, StatePreset, StateSchema, StateVariable, Trigger, TriggerOperator, ViabilityGate, ViabilityStatus, WorldDefinition, WorldIdentity, WorldMetadata, WorldRoleDefinition };
package/dist/types.js ADDED
File without changes
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-7P3S7MAY.js";
7
7
  import {
8
8
  loadWorld
9
- } from "./chunk-BXLTEUS4.js";
9
+ } from "./chunk-I4RTIMLX.js";
10
10
  import "./chunk-QWGCMQQD.js";
11
11
 
12
12
  // src/cli/validate.ts
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-AKW5YVCE.js";
11
11
  import {
12
12
  loadWorld
13
- } from "./chunk-BXLTEUS4.js";
13
+ } from "./chunk-I4RTIMLX.js";
14
14
  import "./chunk-QWGCMQQD.js";
15
15
 
16
16
  // src/cli/world.ts
@@ -3,7 +3,7 @@ import {
3
3
  loadBundledWorld,
4
4
  loadWorld,
5
5
  loadWorldFromDirectory
6
- } from "./chunk-BXLTEUS4.js";
6
+ } from "./chunk-I4RTIMLX.js";
7
7
  import "./chunk-QWGCMQQD.js";
8
8
  export {
9
9
  DEFAULT_BUNDLED_WORLD,
@@ -0,0 +1,68 @@
1
+ ---
2
+ world_id: mentraos-spatial
3
+ name: "MentraOS Spatial Governance"
4
+ version: "1.0.0"
5
+ runtime_mode: COMPLIANCE
6
+ description: >
7
+ Spatial governance layer for MentraOS smart glasses. Activates when
8
+ glasses detect zones (via Auki anchors, BLE, geofence) or nearby
9
+ participants (multi-user handshake). Rules are temporary — they apply
10
+ while you're in the space and dissolve when you leave.
11
+ ---
12
+
13
+ # Thesis
14
+
15
+ Smart glasses live in the real world. The rules that apply at home don't apply at a hospital. The rules that apply when you're alone don't apply when you're standing next to someone who doesn't want to be recorded. Spatial governance makes AI respect the physical context it operates in.
16
+
17
+ This world governs the spatial layer — the bridge between physical location and AI behavior. It enforces three principles: (1) zones publish rules and users opt in explicitly, (2) when multiple AR users share a space their governance composes via handshake with "most restrictive wins," and (3) all spatial rules are temporary — they dissolve when you leave.
18
+
19
+ This layer sits between user rules (which always win) and the platform world. A zone can tighten your rules, never relax them. A handshake participant can tighten the group, never relax it.
20
+
21
+ # Invariants
22
+
23
+ - `opt_in_required` — Users must explicitly accept a zone's rules before they apply. No zone can force governance on a user without consent. Discovery is passive; acceptance is active. (structural, immutable)
24
+ - `most_restrictive_wins` — When zone rules, handshake rules, and user rules overlap, the most restrictive value for each field wins. A zone cannot relax your personal rules. A single handshake participant blocking recording means nobody records. (structural, immutable)
25
+ - `rules_are_temporary` — Spatial rules apply only during the spatial session. When you leave a zone or a handshake dissolves, the rules dissolve with it. No spatial rule persists beyond the session. (structural, immutable)
26
+ - `no_identity_leak` — Handshake negotiation shares governance constraints, not identity. "I require no recording" is a constraint, not a name. Participants are anonymous by default. (structural, immutable)
27
+ - `zone_transparency` — When a zone's rules are active, the user must be able to see which zone they're in, what rules apply, and how to exit. No invisible governance. (structural, immutable)
28
+ - `user_can_always_leave` — A user can exit any zone or leave any handshake at any time. Governance never traps the user. If you don't like the rules, you leave. Your personal rules remain. (structural, immutable)
29
+ - `physics_over_policy` — Hardware constraints override spatial rules. If glasses don't have a camera, a zone rule allowing cameras is irrelevant. Physics always wins. (structural, immutable)
30
+ - `bystander_default_protection` — In any space with non-consenting bystanders, the default is elevated bystander protection. Zones can tighten this to strict. No zone can lower it below standard. (structural, immutable)
31
+
32
+ # State
33
+
34
+ - `active_zone` — string, initial "none". The currently active zone ID.
35
+ - `zone_opt_ins` — counter, initial 0. Number of zone opt-ins this session.
36
+ - `zone_declines` — counter, initial 0. Number of zone opt-in declines.
37
+ - `handshake_participants` — counter, initial 0. Current handshake participant count.
38
+ - `handshake_negotiations` — counter, initial 0. Number of handshake re-negotiations.
39
+ - `spatial_blocks` — counter, initial 0. Number of intents blocked by spatial rules.
40
+ - `spatial_confirms` — counter, initial 0. Number of intents requiring spatial confirmation.
41
+ - `spatial_trust` — score, initial 1.0, range [0.0, 1.0]. Spatial governance health score.
42
+
43
+ # Assumptions
44
+
45
+ - `standard` — Default spatial behavior. zone_opt_in_required=true, handshake_auto_join=false, bystander_protection=elevated, max_handshake_participants=10
46
+ - `strict` — Privacy-first spatial. zone_opt_in_required=true, handshake_auto_join=false, bystander_protection=strict, max_handshake_participants=5
47
+ - `open` — For controlled spaces (home, private office). zone_opt_in_required=false, handshake_auto_join=true, bystander_protection=standard, max_handshake_participants=20
48
+
49
+ # Rules
50
+
51
+ - `rule-001` — Zone rules applied without opt-in. trigger: zone_active AND NOT zone_opted_in → spatial_trust *= 0.10, BLOCK: "Zone rules cannot apply without your explicit opt-in."
52
+ - `rule-002` — Handshake identity leaked. trigger: handshake_active AND identity_shared → spatial_trust *= 0.05, BLOCK: "Handshake negotiation must be anonymous."
53
+ - `rule-003` — Bystander protection violated. trigger: bystander_protection == "strict" AND camera == "allowed" → spatial_trust *= 0.20, BLOCK: "Camera blocked in strict bystander protection zone."
54
+ - `rule-004` — Zone exit blocked. trigger: user_exit_requested AND exit_denied → spatial_trust *= 0.01, BLOCK: "Users must always be able to exit a zone."
55
+ - `rule-005` — Spatial rules persisted beyond session. trigger: session_ended AND spatial_rules_active → spatial_trust *= 0.10, BLOCK: "Spatial rules must dissolve when session ends."
56
+ - `rule-006` — Clean spatial session (advantage). trigger: zone_opt_ins > 0 AND spatial_blocks == 0 → spatial_trust *= 1.08
57
+ - `rule-007` — Zone relaxing user rules. trigger: zone_rule_less_restrictive_than_user_rule → spatial_trust *= 0.30, BLOCK: "Zones can only tighten rules, never relax them."
58
+
59
+ # Gates
60
+
61
+ - ACTIVE: spatial_trust >= 0.7
62
+ - CAUTIOUS: spatial_trust >= 0.3
63
+ - SUSPENDED: spatial_trust < 0.3
64
+
65
+ # Outcomes
66
+
67
+ - `clean_spatial` — Desired. User navigated zones and handshakes with no governance violations. Tracked by: zone_opt_ins > 0 AND spatial_blocks == 0.
68
+ - `forced_governance` — Undesired. A zone or handshake tried to apply rules without consent. Tracked by: spatial_trust < 0.5.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuroverseos/governance",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Deterministic governance engine for AI agents — enforce worlds (permanent rules) and plans (mission constraints) with full audit trace",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -48,10 +48,45 @@
48
48
  "import": "./dist/adapters/deep-agents.js",
49
49
  "require": "./dist/adapters/deep-agents.cjs"
50
50
  },
51
+ "./spatial": {
52
+ "types": "./dist/spatial/index.d.ts",
53
+ "import": "./dist/spatial/index.js",
54
+ "require": "./dist/spatial/index.cjs"
55
+ },
51
56
  "./plan": {
52
57
  "types": "./dist/index.d.ts",
53
58
  "import": "./dist/index.js",
54
59
  "require": "./dist/index.cjs"
60
+ },
61
+ "./adapters/mentraos": {
62
+ "types": "./dist/adapters/mentraos.d.ts",
63
+ "import": "./dist/adapters/mentraos.js",
64
+ "require": "./dist/adapters/mentraos.cjs"
65
+ },
66
+ "./engine/guard-engine": {
67
+ "types": "./dist/engine/guard-engine.d.ts",
68
+ "import": "./dist/engine/guard-engine.js",
69
+ "require": "./dist/engine/guard-engine.cjs"
70
+ },
71
+ "./engine/simulate-engine": {
72
+ "types": "./dist/engine/simulate-engine.d.ts",
73
+ "import": "./dist/engine/simulate-engine.js",
74
+ "require": "./dist/engine/simulate-engine.cjs"
75
+ },
76
+ "./engine/bootstrap-parser": {
77
+ "types": "./dist/engine/bootstrap-parser.d.ts",
78
+ "import": "./dist/engine/bootstrap-parser.js",
79
+ "require": "./dist/engine/bootstrap-parser.cjs"
80
+ },
81
+ "./engine/bootstrap-emitter": {
82
+ "types": "./dist/engine/bootstrap-emitter.d.ts",
83
+ "import": "./dist/engine/bootstrap-emitter.js",
84
+ "require": "./dist/engine/bootstrap-emitter.cjs"
85
+ },
86
+ "./types": {
87
+ "types": "./dist/types.d.ts",
88
+ "import": "./dist/types.js",
89
+ "require": "./dist/types.cjs"
55
90
  }
56
91
  },
57
92
  "bin": {
@@ -73,7 +108,7 @@
73
108
  ".well-known"
74
109
  ],
75
110
  "scripts": {
76
- "build": "tsup src/index.ts src/cli/neuroverse.ts src/cli/plan.ts src/cli/run.ts src/adapters/index.ts src/adapters/langchain.ts src/adapters/openai.ts src/adapters/openclaw.ts src/adapters/express.ts src/adapters/autoresearch.ts src/adapters/deep-agents.ts --format esm,cjs --dts --clean && npm run build:browser && cp src/worlds/*.nv-world.md dist/worlds/ && npm run build:viz",
111
+ "build": "tsup src/index.ts src/types.ts src/cli/neuroverse.ts src/cli/plan.ts src/cli/run.ts src/adapters/index.ts src/adapters/langchain.ts src/adapters/openai.ts src/adapters/openclaw.ts src/adapters/express.ts src/adapters/autoresearch.ts src/adapters/deep-agents.ts src/adapters/mentraos.ts src/engine/guard-engine.ts src/engine/simulate-engine.ts src/engine/bootstrap-parser.ts src/engine/bootstrap-emitter.ts src/spatial/index.ts --format esm,cjs --dts --clean && npm run build:browser && cp src/worlds/*.nv-world.md dist/worlds/ && cp src/spatial/zones/*.nv-world.md dist/worlds/ && npm run build:viz",
77
112
  "build:browser": "tsup src/browser.ts --format iife --global-name NeuroVerse --outDir dist --no-dts",
78
113
  "build:viz": "vite build",
79
114
  "dev:viz": "vite dev",
@@ -122,7 +157,15 @@
122
157
  "deep-agents",
123
158
  "coding-agents",
124
159
  "ai-firewall",
125
- "agent-guardrails"
160
+ "agent-guardrails",
161
+ "smart-glasses",
162
+ "spatial-governance",
163
+ "mentra",
164
+ "mentraos",
165
+ "ar-governance",
166
+ "spatial-handshake",
167
+ "zone-governance",
168
+ "auki"
126
169
  ],
127
170
  "repository": {
128
171
  "type": "git",
@@ -1,11 +1,11 @@
1
+ import {
2
+ readAuditLog
3
+ } from "./chunk-2VAWP6FI.js";
1
4
  import {
2
5
  adaptationFromVerdict,
3
6
  detectBehavioralPatterns,
4
7
  generateAdaptationNarrative
5
8
  } from "./chunk-CNSO6XW5.js";
6
- import {
7
- readAuditLog
8
- } from "./chunk-2VAWP6FI.js";
9
9
  import "./chunk-ZAF6JH23.js";
10
10
  import "./chunk-QLPTHTVB.js";
11
11
  import "./chunk-QWGCMQQD.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  BOOTSTRAP_EXIT_CODES
3
3
  } from "./chunk-4NGDRRQH.js";
4
- import {
5
- parseWorldMarkdown
6
- } from "./chunk-3NZMMSOW.js";
7
4
  import {
8
5
  emitWorldDefinition
9
6
  } from "./chunk-YPCVY4GS.js";
7
+ import {
8
+ parseWorldMarkdown
9
+ } from "./chunk-3NZMMSOW.js";
10
10
  import "./chunk-QWGCMQQD.js";
11
11
 
12
12
  // src/cli/bootstrap.ts
File without changes
@@ -1,18 +1,18 @@
1
- import {
2
- loadConfig
3
- } from "./chunk-OT6PXH54.js";
4
1
  import {
5
2
  createProvider
6
3
  } from "./chunk-INWQHLPS.js";
4
+ import {
5
+ loadConfig
6
+ } from "./chunk-OT6PXH54.js";
7
7
  import {
8
8
  validateWorld
9
9
  } from "./chunk-7P3S7MAY.js";
10
- import {
11
- parseWorldMarkdown
12
- } from "./chunk-3NZMMSOW.js";
13
10
  import {
14
11
  emitWorldDefinition
15
12
  } from "./chunk-YPCVY4GS.js";
13
+ import {
14
+ parseWorldMarkdown
15
+ } from "./chunk-3NZMMSOW.js";
16
16
 
17
17
  // src/engine/derive-normalizer.ts
18
18
  function findSections(lines) {
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  CONFIGURE_AI_EXIT_CODES
3
3
  } from "./chunk-FMSTRBBS.js";
4
+ import {
5
+ createProvider
6
+ } from "./chunk-INWQHLPS.js";
4
7
  import {
5
8
  getConfigPath,
6
9
  loadConfig,
7
10
  redactConfig,
8
11
  saveConfig
9
12
  } from "./chunk-OT6PXH54.js";
10
- import {
11
- createProvider
12
- } from "./chunk-INWQHLPS.js";
13
13
  import "./chunk-QWGCMQQD.js";
14
14
 
15
15
  // src/cli/configure-ai.ts