@neuroverseos/governance 0.3.4 → 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 (129) hide show
  1. package/README.md +280 -405
  2. package/dist/adapters/autoresearch.cjs +63 -9
  3. package/dist/adapters/autoresearch.d.cts +2 -1
  4. package/dist/adapters/autoresearch.d.ts +2 -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 +3 -2
  8. package/dist/adapters/deep-agents.d.ts +3 -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 +2 -1
  12. package/dist/adapters/express.d.ts +2 -1
  13. package/dist/adapters/express.js +3 -3
  14. package/dist/adapters/index.cjs +961 -9
  15. package/dist/adapters/index.d.cts +4 -2
  16. package/dist/adapters/index.d.ts +4 -2
  17. package/dist/adapters/index.js +54 -17
  18. package/dist/adapters/langchain.cjs +63 -9
  19. package/dist/adapters/langchain.d.cts +3 -2
  20. package/dist/adapters/langchain.d.ts +3 -2
  21. package/dist/adapters/langchain.js +3 -3
  22. package/dist/adapters/mentraos.cjs +2181 -0
  23. package/dist/adapters/mentraos.d.cts +319 -0
  24. package/dist/adapters/mentraos.d.ts +319 -0
  25. package/dist/adapters/mentraos.js +48 -0
  26. package/dist/adapters/openai.cjs +63 -9
  27. package/dist/adapters/openai.d.cts +3 -2
  28. package/dist/adapters/openai.d.ts +3 -2
  29. package/dist/adapters/openai.js +3 -3
  30. package/dist/adapters/openclaw.cjs +63 -9
  31. package/dist/adapters/openclaw.d.cts +3 -2
  32. package/dist/adapters/openclaw.d.ts +3 -2
  33. package/dist/adapters/openclaw.js +3 -3
  34. package/dist/{add-ROOZLU62.js → add-XSANI3FK.js} +1 -1
  35. package/dist/{behavioral-MJO34S6Q.js → behavioral-SLW7ALEK.js} +4 -4
  36. package/dist/{bootstrap-CQRZVOXK.js → bootstrap-2OW5ZLBL.js} +4 -4
  37. package/dist/bootstrap-contract-DcV6t-8M.d.cts +216 -0
  38. package/dist/bootstrap-contract-DcV6t-8M.d.ts +216 -0
  39. package/dist/browser.global.js +149 -5
  40. package/dist/{build-ZHPMX5AZ.js → build-EGBGZFIJ.js} +6 -6
  41. package/dist/{chunk-A7GKPPU7.js → chunk-2VAWP6FI.js} +1 -1
  42. package/dist/{chunk-3WQLXYTP.js → chunk-3AYKQHYI.js} +2 -2
  43. package/dist/{chunk-EMQDLDAF.js → chunk-3NZMMSOW.js} +80 -2
  44. package/dist/chunk-3S5AD4AB.js +421 -0
  45. package/dist/{chunk-VXHSMA3I.js → chunk-6CV4XG3J.js} +1 -1
  46. package/dist/{chunk-BNKJPUPQ.js → chunk-A7SHG75T.js} +2 -2
  47. package/dist/{chunk-U6U7EJZL.js → chunk-AV7XJJWK.js} +2 -2
  48. package/dist/{chunk-ZWI3NIXK.js → chunk-CYDMUJVZ.js} +54 -3
  49. package/dist/{chunk-F66BVUYB.js → chunk-DA5MHFRR.js} +3 -3
  50. package/dist/{chunk-YEKMVDWK.js → chunk-FHXXD2TI.js} +7 -7
  51. package/dist/{chunk-5TPFNWRU.js → chunk-FS2UUJJO.js} +3 -3
  52. package/dist/{chunk-4FLICVVA.js → chunk-FVOGUCB6.js} +2 -2
  53. package/dist/chunk-GTPV2XGO.js +893 -0
  54. package/dist/{chunk-CTZHONLA.js → chunk-I4RTIMLX.js} +2 -2
  55. package/dist/{chunk-B6OXJLJ5.js → chunk-J2IZBHXJ.js} +4 -4
  56. package/dist/{chunk-TG6SEF24.js → chunk-OQU65525.js} +1 -1
  57. package/dist/{chunk-QXBFT7NI.js → chunk-QMVQ6KPL.js} +2 -2
  58. package/dist/{chunk-G7DJ6VOD.js → chunk-RDA7ISWC.js} +2 -2
  59. package/dist/{chunk-O5ABKEA7.js → chunk-YJ34R5NB.js} +2 -2
  60. package/dist/{chunk-PVTQQS3Y.js → chunk-YPCVY4GS.js} +31 -0
  61. package/dist/{chunk-W7LLXRGY.js → chunk-ZAF6JH23.js} +65 -10
  62. package/dist/{chunk-IS4WUH6Y.js → chunk-ZEIT2QLM.js} +4 -4
  63. package/dist/cli/neuroverse.cjs +4436 -1035
  64. package/dist/cli/neuroverse.js +40 -24
  65. package/dist/cli/plan.cjs +176 -12
  66. package/dist/cli/plan.js +2 -2
  67. package/dist/cli/run.cjs +63 -9
  68. package/dist/cli/run.js +2 -2
  69. package/dist/configure-world-XU2COHOZ.js +705 -0
  70. package/dist/{decision-flow-M63D47LO.js → decision-flow-3K4D72G4.js} +2 -2
  71. package/dist/{demo-G43RLCPK.js → demo-6OQYWRR6.js} +4 -4
  72. package/dist/{derive-LMDUTXDD.js → derive-7Y7YWVLU.js} +5 -5
  73. package/dist/{doctor-6BC6X2VO.js → doctor-NHXI7OQW.js} +3 -1
  74. package/dist/engine/bootstrap-emitter.cjs +241 -0
  75. package/dist/engine/bootstrap-emitter.d.cts +27 -0
  76. package/dist/engine/bootstrap-emitter.d.ts +27 -0
  77. package/dist/{bootstrap-emitter-Q7UIJZ2O.js → engine/bootstrap-emitter.js} +2 -2
  78. package/dist/engine/bootstrap-parser.cjs +560 -0
  79. package/dist/engine/bootstrap-parser.d.cts +96 -0
  80. package/dist/engine/bootstrap-parser.d.ts +96 -0
  81. package/dist/{bootstrap-parser-EEF36XDU.js → engine/bootstrap-parser.js} +2 -2
  82. package/dist/engine/guard-engine.cjs +1116 -0
  83. package/dist/engine/guard-engine.d.cts +60 -0
  84. package/dist/engine/guard-engine.d.ts +60 -0
  85. package/dist/engine/guard-engine.js +12 -0
  86. package/dist/engine/simulate-engine.cjs +390 -0
  87. package/dist/engine/simulate-engine.d.cts +105 -0
  88. package/dist/engine/simulate-engine.d.ts +105 -0
  89. package/dist/engine/simulate-engine.js +9 -0
  90. package/dist/{equity-penalties-SG5IZQ7I.js → equity-penalties-NVBAB5WL.js} +4 -4
  91. package/dist/{explain-RHBU2GBR.js → explain-HDFN4ION.js} +1 -1
  92. package/dist/github-TIKTWOGU.js +27 -0
  93. package/dist/{guard-AEEJNWLD.js → guard-6KSCWT2W.js} +4 -4
  94. package/dist/{guard-contract-B7lplwm9.d.cts → guard-contract-C991HDZp.d.cts} +32 -309
  95. package/dist/{guard-contract-B7lplwm9.d.ts → guard-contract-hHjTTjtR.d.ts} +32 -309
  96. package/dist/{impact-3XVDSCBU.js → impact-WIAM66IH.js} +3 -3
  97. package/dist/{improve-TQP4ECSY.js → improve-2PWGGO5B.js} +3 -3
  98. package/dist/index.cjs +682 -14
  99. package/dist/index.d.cts +231 -423
  100. package/dist/index.d.ts +231 -423
  101. package/dist/index.js +81 -58
  102. package/dist/{init-FYPV4SST.js → init-TKIJDR7I.js} +5 -1
  103. package/dist/lens-MHMUDCMQ.js +1084 -0
  104. package/dist/{mcp-server-5Y3ZM7TV.js → mcp-server-TNIWZ7B5.js} +3 -3
  105. package/dist/{playground-VZBNPPBO.js → playground-3FLDGBET.js} +3 -3
  106. package/dist/{redteam-MZPZD3EF.js → redteam-HV6LMKEH.js} +3 -3
  107. package/dist/{session-JYOARW54.js → session-XZP2754M.js} +3 -3
  108. package/dist/{shared-C_zpdvBm.d.cts → shared-DGnn1jiS.d.cts} +1 -1
  109. package/dist/{shared-Cf7yxx4-.d.ts → shared-U405h52W.d.ts} +1 -1
  110. package/dist/{simulate-LJXYBC6M.js → simulate-VT437EEL.js} +17 -4
  111. package/dist/spatial/index.cjs +682 -0
  112. package/dist/spatial/index.d.cts +517 -0
  113. package/dist/spatial/index.d.ts +517 -0
  114. package/dist/spatial/index.js +633 -0
  115. package/dist/{test-BOOR4A5F.js → test-4WTX6RKQ.js} +3 -3
  116. package/dist/{trace-PKV4KX56.js → trace-2YDNAXMK.js} +2 -2
  117. package/dist/types.cjs +18 -0
  118. package/dist/types.d.cts +370 -0
  119. package/dist/types.d.ts +370 -0
  120. package/dist/types.js +0 -0
  121. package/dist/{validate-RALX7CZS.js → validate-M52DX22Y.js} +1 -1
  122. package/dist/{world-BIP4GZBZ.js → world-O4HTQPDP.js} +1 -1
  123. package/dist/{world-loader-Y6HMQH2D.js → world-loader-YTYFOP7D.js} +1 -1
  124. package/dist/worlds/mentraos-smartglasses.nv-world.md +423 -0
  125. package/dist/worlds/mentraos-spatial.nv-world.md +68 -0
  126. package/dist/worlds/user-rules.nv-world.md +328 -0
  127. package/package.json +46 -3
  128. package/dist/guard-engine-PNR6MHCM.js +0 -10
  129. package/dist/{configure-ai-5MP5DWTT.js → configure-ai-LL3VAPQW.js} +3 -3
@@ -383,6 +383,33 @@ function evaluateGuard(event, world, options = {}) {
383
383
  let decidingId;
384
384
  const guardsMatched = [];
385
385
  const rulesMatched = [];
386
+ if (options.emergencyOverride) {
387
+ checkInvariantCoverage(world, invariantChecks);
388
+ return buildVerdict(
389
+ "ALLOW",
390
+ void 0,
391
+ "emergency-override",
392
+ "Emergency override active \u2014 all governance rules suspended. Platform constraints still apply.",
393
+ world,
394
+ level,
395
+ invariantChecks,
396
+ guardsMatched,
397
+ rulesMatched,
398
+ includeTrace ? buildTrace(
399
+ invariantChecks,
400
+ safetyChecks,
401
+ planCheckResult,
402
+ roleChecks,
403
+ guardChecks,
404
+ kernelRuleChecks,
405
+ levelChecks,
406
+ "session-allowlist",
407
+ "emergency-override",
408
+ startTime
409
+ ) : void 0,
410
+ event.intent
411
+ );
412
+ }
386
413
  checkInvariantCoverage(world, invariantChecks);
387
414
  if (event.roleId && options.agentStates) {
388
415
  const agentState = options.agentStates.get(event.roleId);
@@ -447,7 +474,8 @@ function evaluateGuard(event, world, options = {}) {
447
474
  decidingLayer,
448
475
  decidingId,
449
476
  startTime
450
- ) : void 0
477
+ ) : void 0,
478
+ event.intent
451
479
  );
452
480
  }
453
481
  }
@@ -476,7 +504,8 @@ function evaluateGuard(event, world, options = {}) {
476
504
  decidingLayer,
477
505
  decidingId,
478
506
  startTime
479
- ) : void 0
507
+ ) : void 0,
508
+ event.intent
480
509
  );
481
510
  }
482
511
  if (options.plan) {
@@ -511,7 +540,8 @@ function evaluateGuard(event, world, options = {}) {
511
540
  decidingLayer,
512
541
  decidingId,
513
542
  startTime
514
- ) : void 0
543
+ ) : void 0,
544
+ event.intent
515
545
  );
516
546
  }
517
547
  }
@@ -540,7 +570,8 @@ function evaluateGuard(event, world, options = {}) {
540
570
  decidingLayer,
541
571
  decidingId,
542
572
  startTime
543
- ) : void 0
573
+ ) : void 0,
574
+ event.intent
544
575
  );
545
576
  }
546
577
  const guardVerdict = checkGuards(event, eventText, world, guardChecks, guardsMatched);
@@ -578,7 +609,8 @@ function evaluateGuard(event, world, options = {}) {
578
609
  decidingLayer,
579
610
  decidingId,
580
611
  startTime
581
- ) : void 0
612
+ ) : void 0,
613
+ event.intent
582
614
  );
583
615
  verdict.intentRecord = intentRecord;
584
616
  if (guardVerdict.consequence) verdict.consequence = guardVerdict.consequence;
@@ -611,7 +643,8 @@ function evaluateGuard(event, world, options = {}) {
611
643
  decidingLayer,
612
644
  decidingId,
613
645
  startTime
614
- ) : void 0
646
+ ) : void 0,
647
+ event.intent
615
648
  );
616
649
  }
617
650
  const levelVerdict = checkLevelConstraints(event, level, levelChecks);
@@ -639,7 +672,8 @@ function evaluateGuard(event, world, options = {}) {
639
672
  decidingLayer,
640
673
  decidingId,
641
674
  startTime
642
- ) : void 0
675
+ ) : void 0,
676
+ event.intent
643
677
  );
644
678
  }
645
679
  const warning = guardVerdict?.warning;
@@ -664,7 +698,8 @@ function evaluateGuard(event, world, options = {}) {
664
698
  decidingLayer,
665
699
  decidingId,
666
700
  startTime
667
- ) : void 0
701
+ ) : void 0,
702
+ event.intent
668
703
  );
669
704
  }
670
705
  function checkInvariantCoverage(world, checks) {
@@ -1041,7 +1076,7 @@ function buildTrace(invariantChecks, safetyChecks, planCheck, roleChecks, guardC
1041
1076
  }
1042
1077
  return trace;
1043
1078
  }
1044
- function buildVerdict(status, reason, ruleId, warning, world, level, invariantChecks, guardsMatched, rulesMatched, trace) {
1079
+ function buildVerdict(status, reason, ruleId, warning, world, level, invariantChecks, guardsMatched, rulesMatched, trace, eventIntent) {
1045
1080
  const evidence = {
1046
1081
  worldId: world.world.world_id,
1047
1082
  worldName: world.world.name,
@@ -1061,8 +1096,27 @@ function buildVerdict(status, reason, ruleId, warning, world, level, invariantCh
1061
1096
  if (ruleId) verdict.ruleId = ruleId;
1062
1097
  if (warning) verdict.warning = warning;
1063
1098
  if (trace) verdict.trace = trace;
1099
+ verdict.event = verdictToEvent(status, eventIntent);
1064
1100
  return verdict;
1065
1101
  }
1102
+ function verdictToEvent(status, intent) {
1103
+ const statusEventMap = {
1104
+ ALLOW: "action_allowed",
1105
+ BLOCK: "action_blocked",
1106
+ PAUSE: "action_paused",
1107
+ MODIFY: "action_modified",
1108
+ PENALIZE: "action_penalized",
1109
+ REWARD: "action_rewarded",
1110
+ NEUTRAL: "action_neutral"
1111
+ };
1112
+ return {
1113
+ type: intent || statusEventMap[status] || "unknown_action",
1114
+ actor: "agent",
1115
+ source: "guard",
1116
+ timestamp: Date.now(),
1117
+ guardStatus: status
1118
+ };
1119
+ }
1066
1120
 
1067
1121
  // src/loader/world-loader.ts
1068
1122
  async function loadWorldFromDirectory(dirPath) {
@@ -1,4 +1,5 @@
1
- import { W as WorldDefinition, G as GuardEvent, a as GuardVerdict } from '../guard-contract-B7lplwm9.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-B7lplwm9.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-QXBFT7NI.js";
5
- import "../chunk-W7LLXRGY.js";
4
+ } from "../chunk-QMVQ6KPL.js";
5
+ import "../chunk-ZAF6JH23.js";
6
+ import "../chunk-I4RTIMLX.js";
6
7
  import "../chunk-QLPTHTVB.js";
7
- import "../chunk-CTZHONLA.js";
8
8
  import "../chunk-QWGCMQQD.js";
9
9
  export {
10
10
  AutoresearchGovernor,
@@ -420,6 +420,33 @@ function evaluateGuard(event, world, options = {}) {
420
420
  let decidingId;
421
421
  const guardsMatched = [];
422
422
  const rulesMatched = [];
423
+ if (options.emergencyOverride) {
424
+ checkInvariantCoverage(world, invariantChecks);
425
+ return buildVerdict(
426
+ "ALLOW",
427
+ void 0,
428
+ "emergency-override",
429
+ "Emergency override active \u2014 all governance rules suspended. Platform constraints still apply.",
430
+ world,
431
+ level,
432
+ invariantChecks,
433
+ guardsMatched,
434
+ rulesMatched,
435
+ includeTrace ? buildTrace(
436
+ invariantChecks,
437
+ safetyChecks,
438
+ planCheckResult,
439
+ roleChecks,
440
+ guardChecks,
441
+ kernelRuleChecks,
442
+ levelChecks,
443
+ "session-allowlist",
444
+ "emergency-override",
445
+ startTime
446
+ ) : void 0,
447
+ event.intent
448
+ );
449
+ }
423
450
  checkInvariantCoverage(world, invariantChecks);
424
451
  if (event.roleId && options.agentStates) {
425
452
  const agentState = options.agentStates.get(event.roleId);
@@ -484,7 +511,8 @@ function evaluateGuard(event, world, options = {}) {
484
511
  decidingLayer,
485
512
  decidingId,
486
513
  startTime
487
- ) : void 0
514
+ ) : void 0,
515
+ event.intent
488
516
  );
489
517
  }
490
518
  }
@@ -513,7 +541,8 @@ function evaluateGuard(event, world, options = {}) {
513
541
  decidingLayer,
514
542
  decidingId,
515
543
  startTime
516
- ) : void 0
544
+ ) : void 0,
545
+ event.intent
517
546
  );
518
547
  }
519
548
  if (options.plan) {
@@ -548,7 +577,8 @@ function evaluateGuard(event, world, options = {}) {
548
577
  decidingLayer,
549
578
  decidingId,
550
579
  startTime
551
- ) : void 0
580
+ ) : void 0,
581
+ event.intent
552
582
  );
553
583
  }
554
584
  }
@@ -577,7 +607,8 @@ function evaluateGuard(event, world, options = {}) {
577
607
  decidingLayer,
578
608
  decidingId,
579
609
  startTime
580
- ) : void 0
610
+ ) : void 0,
611
+ event.intent
581
612
  );
582
613
  }
583
614
  const guardVerdict = checkGuards(event, eventText, world, guardChecks, guardsMatched);
@@ -615,7 +646,8 @@ function evaluateGuard(event, world, options = {}) {
615
646
  decidingLayer,
616
647
  decidingId,
617
648
  startTime
618
- ) : void 0
649
+ ) : void 0,
650
+ event.intent
619
651
  );
620
652
  verdict.intentRecord = intentRecord;
621
653
  if (guardVerdict.consequence) verdict.consequence = guardVerdict.consequence;
@@ -648,7 +680,8 @@ function evaluateGuard(event, world, options = {}) {
648
680
  decidingLayer,
649
681
  decidingId,
650
682
  startTime
651
- ) : void 0
683
+ ) : void 0,
684
+ event.intent
652
685
  );
653
686
  }
654
687
  const levelVerdict = checkLevelConstraints(event, level, levelChecks);
@@ -676,7 +709,8 @@ function evaluateGuard(event, world, options = {}) {
676
709
  decidingLayer,
677
710
  decidingId,
678
711
  startTime
679
- ) : void 0
712
+ ) : void 0,
713
+ event.intent
680
714
  );
681
715
  }
682
716
  const warning = guardVerdict?.warning;
@@ -701,7 +735,8 @@ function evaluateGuard(event, world, options = {}) {
701
735
  decidingLayer,
702
736
  decidingId,
703
737
  startTime
704
- ) : void 0
738
+ ) : void 0,
739
+ event.intent
705
740
  );
706
741
  }
707
742
  function checkInvariantCoverage(world, checks) {
@@ -1078,7 +1113,7 @@ function buildTrace(invariantChecks, safetyChecks, planCheck, roleChecks, guardC
1078
1113
  }
1079
1114
  return trace;
1080
1115
  }
1081
- function buildVerdict(status, reason, ruleId, warning, world, level, invariantChecks, guardsMatched, rulesMatched, trace) {
1116
+ function buildVerdict(status, reason, ruleId, warning, world, level, invariantChecks, guardsMatched, rulesMatched, trace, eventIntent) {
1082
1117
  const evidence = {
1083
1118
  worldId: world.world.world_id,
1084
1119
  worldName: world.world.name,
@@ -1098,8 +1133,27 @@ function buildVerdict(status, reason, ruleId, warning, world, level, invariantCh
1098
1133
  if (ruleId) verdict.ruleId = ruleId;
1099
1134
  if (warning) verdict.warning = warning;
1100
1135
  if (trace) verdict.trace = trace;
1136
+ verdict.event = verdictToEvent(status, eventIntent);
1101
1137
  return verdict;
1102
1138
  }
1139
+ function verdictToEvent(status, intent) {
1140
+ const statusEventMap = {
1141
+ ALLOW: "action_allowed",
1142
+ BLOCK: "action_blocked",
1143
+ PAUSE: "action_paused",
1144
+ MODIFY: "action_modified",
1145
+ PENALIZE: "action_penalized",
1146
+ REWARD: "action_rewarded",
1147
+ NEUTRAL: "action_neutral"
1148
+ };
1149
+ return {
1150
+ type: intent || statusEventMap[status] || "unknown_action",
1151
+ actor: "agent",
1152
+ source: "guard",
1153
+ timestamp: Date.now(),
1154
+ guardStatus: status
1155
+ };
1156
+ }
1103
1157
 
1104
1158
  // src/loader/world-loader.ts
1105
1159
  async function loadWorldFromDirectory(dirPath) {
@@ -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-B7lplwm9.cjs';
2
- import { G as GovernanceBlockedError$1 } from '../shared-C_zpdvBm.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-B7lplwm9.js';
2
- import { G as GovernanceBlockedError$1 } from '../shared-Cf7yxx4-.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-O5ABKEA7.js";
6
+ } from "../chunk-YJ34R5NB.js";
7
7
  import "../chunk-5U2MQO5P.js";
8
- import "../chunk-W7LLXRGY.js";
8
+ import "../chunk-ZAF6JH23.js";
9
+ import "../chunk-I4RTIMLX.js";
9
10
  import "../chunk-QLPTHTVB.js";
10
- import "../chunk-CTZHONLA.js";
11
11
  import "../chunk-QWGCMQQD.js";
12
12
  export {
13
13
  DeepAgentsGuard,
@@ -383,6 +383,33 @@ function evaluateGuard(event, world, options = {}) {
383
383
  let decidingId;
384
384
  const guardsMatched = [];
385
385
  const rulesMatched = [];
386
+ if (options.emergencyOverride) {
387
+ checkInvariantCoverage(world, invariantChecks);
388
+ return buildVerdict(
389
+ "ALLOW",
390
+ void 0,
391
+ "emergency-override",
392
+ "Emergency override active \u2014 all governance rules suspended. Platform constraints still apply.",
393
+ world,
394
+ level,
395
+ invariantChecks,
396
+ guardsMatched,
397
+ rulesMatched,
398
+ includeTrace ? buildTrace(
399
+ invariantChecks,
400
+ safetyChecks,
401
+ planCheckResult,
402
+ roleChecks,
403
+ guardChecks,
404
+ kernelRuleChecks,
405
+ levelChecks,
406
+ "session-allowlist",
407
+ "emergency-override",
408
+ startTime
409
+ ) : void 0,
410
+ event.intent
411
+ );
412
+ }
386
413
  checkInvariantCoverage(world, invariantChecks);
387
414
  if (event.roleId && options.agentStates) {
388
415
  const agentState = options.agentStates.get(event.roleId);
@@ -447,7 +474,8 @@ function evaluateGuard(event, world, options = {}) {
447
474
  decidingLayer,
448
475
  decidingId,
449
476
  startTime
450
- ) : void 0
477
+ ) : void 0,
478
+ event.intent
451
479
  );
452
480
  }
453
481
  }
@@ -476,7 +504,8 @@ function evaluateGuard(event, world, options = {}) {
476
504
  decidingLayer,
477
505
  decidingId,
478
506
  startTime
479
- ) : void 0
507
+ ) : void 0,
508
+ event.intent
480
509
  );
481
510
  }
482
511
  if (options.plan) {
@@ -511,7 +540,8 @@ function evaluateGuard(event, world, options = {}) {
511
540
  decidingLayer,
512
541
  decidingId,
513
542
  startTime
514
- ) : void 0
543
+ ) : void 0,
544
+ event.intent
515
545
  );
516
546
  }
517
547
  }
@@ -540,7 +570,8 @@ function evaluateGuard(event, world, options = {}) {
540
570
  decidingLayer,
541
571
  decidingId,
542
572
  startTime
543
- ) : void 0
573
+ ) : void 0,
574
+ event.intent
544
575
  );
545
576
  }
546
577
  const guardVerdict = checkGuards(event, eventText, world, guardChecks, guardsMatched);
@@ -578,7 +609,8 @@ function evaluateGuard(event, world, options = {}) {
578
609
  decidingLayer,
579
610
  decidingId,
580
611
  startTime
581
- ) : void 0
612
+ ) : void 0,
613
+ event.intent
582
614
  );
583
615
  verdict.intentRecord = intentRecord;
584
616
  if (guardVerdict.consequence) verdict.consequence = guardVerdict.consequence;
@@ -611,7 +643,8 @@ function evaluateGuard(event, world, options = {}) {
611
643
  decidingLayer,
612
644
  decidingId,
613
645
  startTime
614
- ) : void 0
646
+ ) : void 0,
647
+ event.intent
615
648
  );
616
649
  }
617
650
  const levelVerdict = checkLevelConstraints(event, level, levelChecks);
@@ -639,7 +672,8 @@ function evaluateGuard(event, world, options = {}) {
639
672
  decidingLayer,
640
673
  decidingId,
641
674
  startTime
642
- ) : void 0
675
+ ) : void 0,
676
+ event.intent
643
677
  );
644
678
  }
645
679
  const warning = guardVerdict?.warning;
@@ -664,7 +698,8 @@ function evaluateGuard(event, world, options = {}) {
664
698
  decidingLayer,
665
699
  decidingId,
666
700
  startTime
667
- ) : void 0
701
+ ) : void 0,
702
+ event.intent
668
703
  );
669
704
  }
670
705
  function checkInvariantCoverage(world, checks) {
@@ -1041,7 +1076,7 @@ function buildTrace(invariantChecks, safetyChecks, planCheck, roleChecks, guardC
1041
1076
  }
1042
1077
  return trace;
1043
1078
  }
1044
- function buildVerdict(status, reason, ruleId, warning, world, level, invariantChecks, guardsMatched, rulesMatched, trace) {
1079
+ function buildVerdict(status, reason, ruleId, warning, world, level, invariantChecks, guardsMatched, rulesMatched, trace, eventIntent) {
1045
1080
  const evidence = {
1046
1081
  worldId: world.world.world_id,
1047
1082
  worldName: world.world.name,
@@ -1061,8 +1096,27 @@ function buildVerdict(status, reason, ruleId, warning, world, level, invariantCh
1061
1096
  if (ruleId) verdict.ruleId = ruleId;
1062
1097
  if (warning) verdict.warning = warning;
1063
1098
  if (trace) verdict.trace = trace;
1099
+ verdict.event = verdictToEvent(status, eventIntent);
1064
1100
  return verdict;
1065
1101
  }
1102
+ function verdictToEvent(status, intent) {
1103
+ const statusEventMap = {
1104
+ ALLOW: "action_allowed",
1105
+ BLOCK: "action_blocked",
1106
+ PAUSE: "action_paused",
1107
+ MODIFY: "action_modified",
1108
+ PENALIZE: "action_penalized",
1109
+ REWARD: "action_rewarded",
1110
+ NEUTRAL: "action_neutral"
1111
+ };
1112
+ return {
1113
+ type: intent || statusEventMap[status] || "unknown_action",
1114
+ actor: "agent",
1115
+ source: "guard",
1116
+ timestamp: Date.now(),
1117
+ guardStatus: status
1118
+ };
1119
+ }
1066
1120
 
1067
1121
  // src/loader/world-loader.ts
1068
1122
  async function loadWorldFromDirectory(dirPath) {
@@ -1,4 +1,5 @@
1
- import { a as GuardVerdict, G as GuardEvent, W as WorldDefinition } from '../guard-contract-B7lplwm9.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-B7lplwm9.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-G7DJ6VOD.js";
5
- import "../chunk-W7LLXRGY.js";
4
+ } from "../chunk-RDA7ISWC.js";
5
+ import "../chunk-ZAF6JH23.js";
6
+ import "../chunk-I4RTIMLX.js";
6
7
  import "../chunk-QLPTHTVB.js";
7
- import "../chunk-CTZHONLA.js";
8
8
  import "../chunk-QWGCMQQD.js";
9
9
  export {
10
10
  createGovernanceMiddleware,