@neuroverseos/governance 0.3.3 → 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.
- package/README.md +280 -405
- package/dist/adapters/autoresearch.cjs +63 -9
- package/dist/adapters/autoresearch.d.cts +1 -1
- package/dist/adapters/autoresearch.d.ts +1 -1
- package/dist/adapters/autoresearch.js +3 -3
- package/dist/adapters/deep-agents.cjs +63 -9
- package/dist/adapters/deep-agents.d.cts +2 -2
- package/dist/adapters/deep-agents.d.ts +2 -2
- package/dist/adapters/deep-agents.js +3 -3
- package/dist/adapters/express.cjs +63 -9
- package/dist/adapters/express.d.cts +1 -1
- package/dist/adapters/express.d.ts +1 -1
- package/dist/adapters/express.js +3 -3
- package/dist/adapters/index.cjs +896 -9
- package/dist/adapters/index.d.cts +278 -2
- package/dist/adapters/index.d.ts +278 -2
- package/dist/adapters/index.js +45 -8
- package/dist/adapters/langchain.cjs +63 -9
- package/dist/adapters/langchain.d.cts +2 -2
- package/dist/adapters/langchain.d.ts +2 -2
- package/dist/adapters/langchain.js +3 -3
- package/dist/adapters/openai.cjs +63 -9
- package/dist/adapters/openai.d.cts +2 -2
- package/dist/adapters/openai.d.ts +2 -2
- package/dist/adapters/openai.js +3 -3
- package/dist/adapters/openclaw.cjs +63 -9
- package/dist/adapters/openclaw.d.cts +2 -2
- package/dist/adapters/openclaw.d.ts +2 -2
- package/dist/adapters/openclaw.js +3 -3
- package/dist/{add-ROOZLU62.js → add-LYHDZ5RL.js} +1 -1
- package/dist/{behavioral-MJO34S6Q.js → behavioral-SPWPGYXL.js} +2 -2
- package/dist/{bootstrap-CQRZVOXK.js → bootstrap-IP5QMC3Q.js} +2 -2
- package/dist/{bootstrap-emitter-Q7UIJZ2O.js → bootstrap-emitter-GIMOJFOC.js} +1 -1
- package/dist/{bootstrap-parser-EEF36XDU.js → bootstrap-parser-LBLGVEMU.js} +1 -1
- package/dist/browser.global.js +149 -5
- package/dist/{build-QKOBBC23.js → build-THUEYMVT.js} +5 -4
- package/dist/{chunk-G7DJ6VOD.js → chunk-25XHSTPT.js} +2 -2
- package/dist/{chunk-A7GKPPU7.js → chunk-2VAWP6FI.js} +1 -1
- package/dist/{chunk-EMQDLDAF.js → chunk-3NZMMSOW.js} +80 -2
- package/dist/{chunk-B6OXJLJ5.js → chunk-5JUZ4HL7.js} +2 -2
- package/dist/chunk-6CV4XG3J.js +166 -0
- package/dist/{chunk-5TPFNWRU.js → chunk-7D7PZLB7.js} +3 -3
- package/dist/{chunk-ZWI3NIXK.js → chunk-7QIAF377.js} +54 -3
- package/dist/chunk-APU4OZIP.js +828 -0
- package/dist/{chunk-CTZHONLA.js → chunk-BXLTEUS4.js} +2 -2
- package/dist/{chunk-O5ABKEA7.js → chunk-DWHUZUEY.js} +2 -2
- package/dist/chunk-FMSTRBBS.js +17 -0
- package/dist/{chunk-Q6O7ZLO2.js → chunk-INWQHLPS.js} +1 -16
- package/dist/{chunk-U6U7EJZL.js → chunk-JKGPSFGH.js} +2 -2
- package/dist/{chunk-3WQLXYTP.js → chunk-MFKHTE5R.js} +2 -2
- package/dist/{chunk-TG6SEF24.js → chunk-OQU65525.js} +1 -1
- package/dist/{chunk-6S5CFQXY.js → chunk-QZ666FCV.js} +5 -5
- package/dist/{chunk-4FLICVVA.js → chunk-TD5GKIHP.js} +2 -2
- package/dist/{chunk-IS4WUH6Y.js → chunk-UTH7OXTM.js} +2 -2
- package/dist/{chunk-BNKJPUPQ.js → chunk-V4FZHJQX.js} +2 -2
- package/dist/{chunk-F66BVUYB.js → chunk-Y6WXAPKY.js} +3 -3
- package/dist/{chunk-QXBFT7NI.js → chunk-YNYCQECH.js} +2 -2
- package/dist/{chunk-PVTQQS3Y.js → chunk-YPCVY4GS.js} +31 -0
- package/dist/{chunk-W7LLXRGY.js → chunk-ZAF6JH23.js} +65 -10
- package/dist/cli/neuroverse.cjs +3176 -139
- package/dist/cli/neuroverse.js +40 -24
- package/dist/cli/plan.cjs +176 -12
- package/dist/cli/plan.js +2 -2
- package/dist/cli/run.cjs +63 -9
- package/dist/cli/run.js +2 -2
- package/dist/{configure-ai-6TZ3MCSI.js → configure-ai-5MP5DWTT.js} +5 -3
- package/dist/configure-world-XU2COHOZ.js +705 -0
- package/dist/{decision-flow-M63D47LO.js → decision-flow-3K4D72G4.js} +2 -2
- package/dist/{demo-G43RLCPK.js → demo-66MMJTEH.js} +3 -3
- package/dist/{derive-FJZVIPUZ.js → derive-5LOMN7GO.js} +6 -5
- package/dist/{doctor-6BC6X2VO.js → doctor-WIO4FLA3.js} +2 -1
- package/dist/{equity-penalties-SG5IZQ7I.js → equity-penalties-WWC7UDQD.js} +3 -3
- package/dist/{explain-RHBU2GBR.js → explain-MUSGDT67.js} +1 -1
- package/dist/{guard-AJCCGZMF.js → guard-W3BMQPBJ.js} +41 -7
- package/dist/{guard-contract-DqFcTScd.d.cts → guard-contract-CLBbTGK_.d.cts} +107 -1
- package/dist/{guard-contract-DqFcTScd.d.ts → guard-contract-CLBbTGK_.d.ts} +107 -1
- package/dist/{guard-engine-PNR6MHCM.js → guard-engine-N7TUIUU7.js} +5 -3
- package/dist/{impact-3XVDSCBU.js → impact-WIAM66IH.js} +3 -3
- package/dist/{improve-TQP4ECSY.js → improve-PJDAWW4Q.js} +3 -3
- package/dist/index.cjs +425 -62
- package/dist/index.d.cts +290 -66
- package/dist/index.d.ts +290 -66
- package/dist/index.js +33 -24
- package/dist/{init-FYPV4SST.js → init-TKIJDR7I.js} +5 -1
- package/dist/lens-IP6GIZ2Q.js +1017 -0
- package/dist/{mcp-server-5Y3ZM7TV.js → mcp-server-OG3PPVD2.js} +3 -3
- package/dist/mentraos-YFS7FMJH.js +48 -0
- package/dist/{playground-VZBNPPBO.js → playground-4BK2XQ47.js} +2 -2
- package/dist/{redteam-MZPZD3EF.js → redteam-BRZALBPP.js} +2 -2
- package/dist/{session-JYOARW54.js → session-SGRUT2UH.js} +3 -3
- package/dist/{shared-B8dvUUD8.d.cts → shared-BGzmYP5g.d.cts} +1 -1
- package/dist/{shared-Dr5Wiay8.d.ts → shared-CwGpPheR.d.ts} +1 -1
- package/dist/{simulate-LJXYBC6M.js → simulate-FGXKIH7V.js} +17 -4
- package/dist/{test-BOOR4A5F.js → test-PT44BSYG.js} +2 -2
- package/dist/{trace-PKV4KX56.js → trace-2YDNAXMK.js} +2 -2
- package/dist/{validate-RALX7CZS.js → validate-Q5O5TGLT.js} +1 -1
- package/dist/{world-BIP4GZBZ.js → world-V52ZMH26.js} +1 -1
- package/dist/{world-loader-Y6HMQH2D.js → world-loader-C4D3VPP3.js} +1 -1
- package/dist/worlds/mentraos-smartglasses.nv-world.md +423 -0
- package/dist/worlds/user-rules.nv-world.md +328 -0
- package/package.json +1 -1
- package/dist/chunk-MH7BT4VH.js +0 -15
package/dist/adapters/index.js
CHANGED
|
@@ -1,34 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_USER_RULES,
|
|
3
|
+
MENTRA_INTENT_TAXONOMY,
|
|
4
|
+
MENTRA_KNOWN_INTENTS,
|
|
5
|
+
MentraGovernedExecutor,
|
|
6
|
+
createMentraGovernedExecutor,
|
|
7
|
+
createMentraGovernedExecutorFromWorld,
|
|
8
|
+
evaluateUserRules,
|
|
9
|
+
getAIActionIntents,
|
|
10
|
+
getAIDataIntents,
|
|
11
|
+
getAIIntents,
|
|
12
|
+
getExfiltrationIntents,
|
|
13
|
+
getHighRiskIntents,
|
|
14
|
+
getIntentsByGlasses,
|
|
15
|
+
getIntentsByPermission,
|
|
16
|
+
getMentraIntent,
|
|
17
|
+
isAIIntent,
|
|
18
|
+
isIntentSupported
|
|
19
|
+
} from "../chunk-APU4OZIP.js";
|
|
1
20
|
import {
|
|
2
21
|
AutoresearchGovernor
|
|
3
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-YNYCQECH.js";
|
|
4
23
|
import {
|
|
5
24
|
DeepAgentsGuard,
|
|
6
25
|
GovernanceBlockedError as GovernanceBlockedError2,
|
|
7
26
|
createDeepAgentsGuard,
|
|
8
27
|
createDeepAgentsGuardFromWorld
|
|
9
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-DWHUZUEY.js";
|
|
10
29
|
import {
|
|
11
30
|
createGovernanceMiddleware,
|
|
12
31
|
createGovernanceMiddlewareFromWorld
|
|
13
|
-
} from "../chunk-
|
|
32
|
+
} from "../chunk-25XHSTPT.js";
|
|
14
33
|
import {
|
|
15
34
|
GovernanceBlockedError as GovernanceBlockedError3,
|
|
16
35
|
NeuroVerseCallbackHandler,
|
|
17
36
|
createNeuroVerseCallbackHandler,
|
|
18
37
|
createNeuroVerseCallbackHandlerFromWorld
|
|
19
|
-
} from "../chunk-
|
|
38
|
+
} from "../chunk-MFKHTE5R.js";
|
|
20
39
|
import {
|
|
21
40
|
GovernanceBlockedError as GovernanceBlockedError4,
|
|
22
41
|
GovernedToolExecutor,
|
|
23
42
|
createGovernedToolExecutor,
|
|
24
43
|
createGovernedToolExecutorFromWorld
|
|
25
|
-
} from "../chunk-
|
|
44
|
+
} from "../chunk-TD5GKIHP.js";
|
|
26
45
|
import {
|
|
27
46
|
GovernanceBlockedError as GovernanceBlockedError5,
|
|
28
47
|
NeuroVersePlugin,
|
|
29
48
|
createNeuroVersePlugin,
|
|
30
49
|
createNeuroVersePluginFromWorld
|
|
31
|
-
} from "../chunk-
|
|
50
|
+
} from "../chunk-V4FZHJQX.js";
|
|
32
51
|
import {
|
|
33
52
|
GovernanceBlockedError,
|
|
34
53
|
buildEngineOptions,
|
|
@@ -36,17 +55,22 @@ import {
|
|
|
36
55
|
extractScope,
|
|
37
56
|
trackPlanProgress
|
|
38
57
|
} from "../chunk-5U2MQO5P.js";
|
|
39
|
-
import "../chunk-
|
|
58
|
+
import "../chunk-ZAF6JH23.js";
|
|
40
59
|
import "../chunk-QLPTHTVB.js";
|
|
41
|
-
import "../chunk-
|
|
60
|
+
import "../chunk-BXLTEUS4.js";
|
|
42
61
|
import "../chunk-QWGCMQQD.js";
|
|
43
62
|
export {
|
|
44
63
|
AutoresearchGovernor,
|
|
64
|
+
DEFAULT_USER_RULES,
|
|
45
65
|
GovernanceBlockedError2 as DeepAgentsGovernanceBlockedError,
|
|
46
66
|
DeepAgentsGuard,
|
|
47
67
|
GovernanceBlockedError,
|
|
48
68
|
GovernedToolExecutor,
|
|
49
69
|
GovernanceBlockedError3 as LangChainGovernanceBlockedError,
|
|
70
|
+
MENTRA_INTENT_TAXONOMY,
|
|
71
|
+
MENTRA_KNOWN_INTENTS,
|
|
72
|
+
GovernanceBlockedError as MentraGovernanceBlockedError,
|
|
73
|
+
MentraGovernedExecutor,
|
|
50
74
|
NeuroVerseCallbackHandler,
|
|
51
75
|
NeuroVersePlugin,
|
|
52
76
|
GovernanceBlockedError4 as OpenAIGovernanceBlockedError,
|
|
@@ -58,11 +82,24 @@ export {
|
|
|
58
82
|
createGovernanceMiddlewareFromWorld,
|
|
59
83
|
createGovernedToolExecutor,
|
|
60
84
|
createGovernedToolExecutorFromWorld,
|
|
85
|
+
createMentraGovernedExecutor,
|
|
86
|
+
createMentraGovernedExecutorFromWorld,
|
|
61
87
|
createNeuroVerseCallbackHandler,
|
|
62
88
|
createNeuroVerseCallbackHandlerFromWorld,
|
|
63
89
|
createNeuroVersePlugin,
|
|
64
90
|
createNeuroVersePluginFromWorld,
|
|
65
91
|
defaultBlockMessage,
|
|
92
|
+
evaluateUserRules,
|
|
66
93
|
extractScope,
|
|
94
|
+
getAIActionIntents,
|
|
95
|
+
getAIDataIntents,
|
|
96
|
+
getAIIntents,
|
|
97
|
+
getExfiltrationIntents,
|
|
98
|
+
getHighRiskIntents,
|
|
99
|
+
getIntentsByGlasses,
|
|
100
|
+
getIntentsByPermission,
|
|
101
|
+
getMentraIntent,
|
|
102
|
+
isAIIntent,
|
|
103
|
+
isIntentSupported,
|
|
67
104
|
trackPlanProgress
|
|
68
105
|
};
|
|
@@ -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,5 @@
|
|
|
1
|
-
import { G as GuardEvent, a as GuardVerdict, b as GuardEngineOptions, P as PlanDefinition, W as WorldDefinition, c as PlanProgress } from '../guard-contract-
|
|
2
|
-
import { G as GovernanceBlockedError$1 } from '../shared-
|
|
1
|
+
import { G as GuardEvent, a as GuardVerdict, b as GuardEngineOptions, P as PlanDefinition, W as WorldDefinition, c as PlanProgress } from '../guard-contract-CLBbTGK_.cjs';
|
|
2
|
+
import { G as GovernanceBlockedError$1 } from '../shared-BGzmYP5g.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* NeuroVerse Adapter — LangChain
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as GuardEvent, a as GuardVerdict, b as GuardEngineOptions, P as PlanDefinition, W as WorldDefinition, c as PlanProgress } from '../guard-contract-
|
|
2
|
-
import { G as GovernanceBlockedError$1 } from '../shared-
|
|
1
|
+
import { G as GuardEvent, a as GuardVerdict, b as GuardEngineOptions, P as PlanDefinition, W as WorldDefinition, c as PlanProgress } from '../guard-contract-CLBbTGK_.js';
|
|
2
|
+
import { G as GovernanceBlockedError$1 } from '../shared-CwGpPheR.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* NeuroVerse Adapter — LangChain
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
NeuroVerseCallbackHandler,
|
|
4
4
|
createNeuroVerseCallbackHandler,
|
|
5
5
|
createNeuroVerseCallbackHandlerFromWorld
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-MFKHTE5R.js";
|
|
7
7
|
import "../chunk-5U2MQO5P.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-ZAF6JH23.js";
|
|
9
9
|
import "../chunk-QLPTHTVB.js";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-BXLTEUS4.js";
|
|
11
11
|
import "../chunk-QWGCMQQD.js";
|
|
12
12
|
export {
|
|
13
13
|
GovernanceBlockedError,
|
package/dist/adapters/openai.cjs
CHANGED
|
@@ -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,5 @@
|
|
|
1
|
-
import { a as GuardVerdict, G as GuardEvent, P as PlanDefinition, c as PlanProgress, b as GuardEngineOptions, W as WorldDefinition } from '../guard-contract-
|
|
2
|
-
import { G as GovernanceBlockedError$1 } from '../shared-
|
|
1
|
+
import { a as GuardVerdict, G as GuardEvent, P as PlanDefinition, c as PlanProgress, b as GuardEngineOptions, W as WorldDefinition } from '../guard-contract-CLBbTGK_.cjs';
|
|
2
|
+
import { G as GovernanceBlockedError$1 } from '../shared-BGzmYP5g.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* NeuroVerse Adapter — OpenAI
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as GuardVerdict, G as GuardEvent, P as PlanDefinition, c as PlanProgress, b as GuardEngineOptions, W as WorldDefinition } from '../guard-contract-
|
|
2
|
-
import { G as GovernanceBlockedError$1 } from '../shared-
|
|
1
|
+
import { a as GuardVerdict, G as GuardEvent, P as PlanDefinition, c as PlanProgress, b as GuardEngineOptions, W as WorldDefinition } from '../guard-contract-CLBbTGK_.js';
|
|
2
|
+
import { G as GovernanceBlockedError$1 } from '../shared-CwGpPheR.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* NeuroVerse Adapter — OpenAI
|
package/dist/adapters/openai.js
CHANGED
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
GovernedToolExecutor,
|
|
4
4
|
createGovernedToolExecutor,
|
|
5
5
|
createGovernedToolExecutorFromWorld
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-TD5GKIHP.js";
|
|
7
7
|
import "../chunk-5U2MQO5P.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-ZAF6JH23.js";
|
|
9
9
|
import "../chunk-QLPTHTVB.js";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-BXLTEUS4.js";
|
|
11
11
|
import "../chunk-QWGCMQQD.js";
|
|
12
12
|
export {
|
|
13
13
|
GovernanceBlockedError,
|
|
@@ -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,5 @@
|
|
|
1
|
-
import { a as GuardVerdict, b as GuardEngineOptions, P as PlanDefinition, W as WorldDefinition, G as GuardEvent, c as PlanProgress } from '../guard-contract-
|
|
2
|
-
import { G as GovernanceBlockedError$1 } from '../shared-
|
|
1
|
+
import { a as GuardVerdict, b as GuardEngineOptions, P as PlanDefinition, W as WorldDefinition, G as GuardEvent, c as PlanProgress } from '../guard-contract-CLBbTGK_.cjs';
|
|
2
|
+
import { G as GovernanceBlockedError$1 } from '../shared-BGzmYP5g.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* NeuroVerse Adapter — OpenClaw
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as GuardVerdict, b as GuardEngineOptions, P as PlanDefinition, W as WorldDefinition, G as GuardEvent, c as PlanProgress } from '../guard-contract-
|
|
2
|
-
import { G as GovernanceBlockedError$1 } from '../shared-
|
|
1
|
+
import { a as GuardVerdict, b as GuardEngineOptions, P as PlanDefinition, W as WorldDefinition, G as GuardEvent, c as PlanProgress } from '../guard-contract-CLBbTGK_.js';
|
|
2
|
+
import { G as GovernanceBlockedError$1 } from '../shared-CwGpPheR.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* NeuroVerse Adapter — OpenClaw
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
NeuroVersePlugin,
|
|
4
4
|
createNeuroVersePlugin,
|
|
5
5
|
createNeuroVersePluginFromWorld
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-V4FZHJQX.js";
|
|
7
7
|
import "../chunk-5U2MQO5P.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-ZAF6JH23.js";
|
|
9
9
|
import "../chunk-QLPTHTVB.js";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-BXLTEUS4.js";
|
|
11
11
|
import "../chunk-QWGCMQQD.js";
|
|
12
12
|
export {
|
|
13
13
|
GovernanceBlockedError,
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
} from "./chunk-CNSO6XW5.js";
|
|
6
6
|
import {
|
|
7
7
|
readAuditLog
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-2VAWP6FI.js";
|
|
9
|
+
import "./chunk-ZAF6JH23.js";
|
|
10
10
|
import "./chunk-QLPTHTVB.js";
|
|
11
11
|
import "./chunk-QWGCMQQD.js";
|
|
12
12
|
|