@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.
- package/README.md +280 -405
- package/dist/adapters/autoresearch.cjs +63 -9
- package/dist/adapters/autoresearch.d.cts +2 -1
- package/dist/adapters/autoresearch.d.ts +2 -1
- package/dist/adapters/autoresearch.js +3 -3
- package/dist/adapters/deep-agents.cjs +63 -9
- package/dist/adapters/deep-agents.d.cts +3 -2
- package/dist/adapters/deep-agents.d.ts +3 -2
- package/dist/adapters/deep-agents.js +3 -3
- package/dist/adapters/express.cjs +63 -9
- package/dist/adapters/express.d.cts +2 -1
- package/dist/adapters/express.d.ts +2 -1
- package/dist/adapters/express.js +3 -3
- package/dist/adapters/index.cjs +961 -9
- package/dist/adapters/index.d.cts +4 -2
- package/dist/adapters/index.d.ts +4 -2
- package/dist/adapters/index.js +54 -17
- package/dist/adapters/langchain.cjs +63 -9
- package/dist/adapters/langchain.d.cts +3 -2
- package/dist/adapters/langchain.d.ts +3 -2
- package/dist/adapters/langchain.js +3 -3
- package/dist/adapters/mentraos.cjs +2181 -0
- package/dist/adapters/mentraos.d.cts +319 -0
- package/dist/adapters/mentraos.d.ts +319 -0
- package/dist/adapters/mentraos.js +48 -0
- package/dist/adapters/openai.cjs +63 -9
- package/dist/adapters/openai.d.cts +3 -2
- package/dist/adapters/openai.d.ts +3 -2
- package/dist/adapters/openai.js +3 -3
- package/dist/adapters/openclaw.cjs +63 -9
- package/dist/adapters/openclaw.d.cts +3 -2
- package/dist/adapters/openclaw.d.ts +3 -2
- package/dist/adapters/openclaw.js +3 -3
- package/dist/{add-ROOZLU62.js → add-XSANI3FK.js} +1 -1
- package/dist/{behavioral-MJO34S6Q.js → behavioral-SLW7ALEK.js} +4 -4
- package/dist/{bootstrap-CQRZVOXK.js → bootstrap-2OW5ZLBL.js} +4 -4
- package/dist/bootstrap-contract-DcV6t-8M.d.cts +216 -0
- package/dist/bootstrap-contract-DcV6t-8M.d.ts +216 -0
- package/dist/browser.global.js +149 -5
- package/dist/{build-ZHPMX5AZ.js → build-EGBGZFIJ.js} +6 -6
- package/dist/{chunk-A7GKPPU7.js → chunk-2VAWP6FI.js} +1 -1
- package/dist/{chunk-3WQLXYTP.js → chunk-3AYKQHYI.js} +2 -2
- package/dist/{chunk-EMQDLDAF.js → chunk-3NZMMSOW.js} +80 -2
- package/dist/chunk-3S5AD4AB.js +421 -0
- package/dist/{chunk-VXHSMA3I.js → chunk-6CV4XG3J.js} +1 -1
- package/dist/{chunk-BNKJPUPQ.js → chunk-A7SHG75T.js} +2 -2
- package/dist/{chunk-U6U7EJZL.js → chunk-AV7XJJWK.js} +2 -2
- package/dist/{chunk-ZWI3NIXK.js → chunk-CYDMUJVZ.js} +54 -3
- package/dist/{chunk-F66BVUYB.js → chunk-DA5MHFRR.js} +3 -3
- package/dist/{chunk-YEKMVDWK.js → chunk-FHXXD2TI.js} +7 -7
- package/dist/{chunk-5TPFNWRU.js → chunk-FS2UUJJO.js} +3 -3
- package/dist/{chunk-4FLICVVA.js → chunk-FVOGUCB6.js} +2 -2
- package/dist/chunk-GTPV2XGO.js +893 -0
- package/dist/{chunk-CTZHONLA.js → chunk-I4RTIMLX.js} +2 -2
- package/dist/{chunk-B6OXJLJ5.js → chunk-J2IZBHXJ.js} +4 -4
- package/dist/{chunk-TG6SEF24.js → chunk-OQU65525.js} +1 -1
- package/dist/{chunk-QXBFT7NI.js → chunk-QMVQ6KPL.js} +2 -2
- package/dist/{chunk-G7DJ6VOD.js → chunk-RDA7ISWC.js} +2 -2
- package/dist/{chunk-O5ABKEA7.js → chunk-YJ34R5NB.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/{chunk-IS4WUH6Y.js → chunk-ZEIT2QLM.js} +4 -4
- package/dist/cli/neuroverse.cjs +4436 -1035
- 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-world-XU2COHOZ.js +705 -0
- package/dist/{decision-flow-M63D47LO.js → decision-flow-3K4D72G4.js} +2 -2
- package/dist/{demo-G43RLCPK.js → demo-6OQYWRR6.js} +4 -4
- package/dist/{derive-LMDUTXDD.js → derive-7Y7YWVLU.js} +5 -5
- package/dist/{doctor-6BC6X2VO.js → doctor-NHXI7OQW.js} +3 -1
- package/dist/engine/bootstrap-emitter.cjs +241 -0
- package/dist/engine/bootstrap-emitter.d.cts +27 -0
- package/dist/engine/bootstrap-emitter.d.ts +27 -0
- package/dist/{bootstrap-emitter-Q7UIJZ2O.js → engine/bootstrap-emitter.js} +2 -2
- package/dist/engine/bootstrap-parser.cjs +560 -0
- package/dist/engine/bootstrap-parser.d.cts +96 -0
- package/dist/engine/bootstrap-parser.d.ts +96 -0
- package/dist/{bootstrap-parser-EEF36XDU.js → engine/bootstrap-parser.js} +2 -2
- package/dist/engine/guard-engine.cjs +1116 -0
- package/dist/engine/guard-engine.d.cts +60 -0
- package/dist/engine/guard-engine.d.ts +60 -0
- package/dist/engine/guard-engine.js +12 -0
- package/dist/engine/simulate-engine.cjs +390 -0
- package/dist/engine/simulate-engine.d.cts +105 -0
- package/dist/engine/simulate-engine.d.ts +105 -0
- package/dist/engine/simulate-engine.js +9 -0
- package/dist/{equity-penalties-SG5IZQ7I.js → equity-penalties-NVBAB5WL.js} +4 -4
- package/dist/{explain-RHBU2GBR.js → explain-HDFN4ION.js} +1 -1
- package/dist/github-TIKTWOGU.js +27 -0
- package/dist/{guard-AEEJNWLD.js → guard-6KSCWT2W.js} +4 -4
- package/dist/{guard-contract-B7lplwm9.d.cts → guard-contract-C991HDZp.d.cts} +32 -309
- package/dist/{guard-contract-B7lplwm9.d.ts → guard-contract-hHjTTjtR.d.ts} +32 -309
- package/dist/{impact-3XVDSCBU.js → impact-WIAM66IH.js} +3 -3
- package/dist/{improve-TQP4ECSY.js → improve-2PWGGO5B.js} +3 -3
- package/dist/index.cjs +682 -14
- package/dist/index.d.cts +231 -423
- package/dist/index.d.ts +231 -423
- package/dist/index.js +81 -58
- package/dist/{init-FYPV4SST.js → init-TKIJDR7I.js} +5 -1
- package/dist/lens-MHMUDCMQ.js +1084 -0
- package/dist/{mcp-server-5Y3ZM7TV.js → mcp-server-TNIWZ7B5.js} +3 -3
- package/dist/{playground-VZBNPPBO.js → playground-3FLDGBET.js} +3 -3
- package/dist/{redteam-MZPZD3EF.js → redteam-HV6LMKEH.js} +3 -3
- package/dist/{session-JYOARW54.js → session-XZP2754M.js} +3 -3
- package/dist/{shared-C_zpdvBm.d.cts → shared-DGnn1jiS.d.cts} +1 -1
- package/dist/{shared-Cf7yxx4-.d.ts → shared-U405h52W.d.ts} +1 -1
- package/dist/{simulate-LJXYBC6M.js → simulate-VT437EEL.js} +17 -4
- package/dist/spatial/index.cjs +682 -0
- package/dist/spatial/index.d.cts +517 -0
- package/dist/spatial/index.d.ts +517 -0
- package/dist/spatial/index.js +633 -0
- package/dist/{test-BOOR4A5F.js → test-4WTX6RKQ.js} +3 -3
- package/dist/{trace-PKV4KX56.js → trace-2YDNAXMK.js} +2 -2
- package/dist/types.cjs +18 -0
- package/dist/types.d.cts +370 -0
- package/dist/types.d.ts +370 -0
- package/dist/types.js +0 -0
- package/dist/{validate-RALX7CZS.js → validate-M52DX22Y.js} +1 -1
- package/dist/{world-BIP4GZBZ.js → world-O4HTQPDP.js} +1 -1
- package/dist/{world-loader-Y6HMQH2D.js → world-loader-YTYFOP7D.js} +1 -1
- package/dist/worlds/mentraos-smartglasses.nv-world.md +423 -0
- package/dist/worlds/mentraos-spatial.nv-world.md +68 -0
- package/dist/worlds/user-rules.nv-world.md +328 -0
- package/package.json +46 -3
- package/dist/guard-engine-PNR6MHCM.js +0 -10
- package/dist/{configure-ai-5MP5DWTT.js → configure-ai-LL3VAPQW.js} +3 -3
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,6 @@
|
|
|
1
|
-
import { a as GuardVerdict, G as GuardEvent, P as PlanDefinition, c as PlanProgress, b as GuardEngineOptions
|
|
2
|
-
import {
|
|
1
|
+
import { a as GuardVerdict, G as GuardEvent, P as PlanDefinition, c as PlanProgress, b as GuardEngineOptions } 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
|
* NeuroVerse Adapter — OpenAI
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { a as GuardVerdict, G as GuardEvent, P as PlanDefinition, c as PlanProgress, b as GuardEngineOptions
|
|
2
|
-
import {
|
|
1
|
+
import { a as GuardVerdict, G as GuardEvent, P as PlanDefinition, c as PlanProgress, b as GuardEngineOptions } 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
|
* 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-FVOGUCB6.js";
|
|
7
7
|
import "../chunk-5U2MQO5P.js";
|
|
8
|
-
import "../chunk-
|
|
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
|
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,6 @@
|
|
|
1
|
-
import { a as GuardVerdict, b as GuardEngineOptions, P as PlanDefinition,
|
|
2
|
-
import {
|
|
1
|
+
import { a as GuardVerdict, b as GuardEngineOptions, P as PlanDefinition, 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
|
* NeuroVerse Adapter — OpenClaw
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { a as GuardVerdict, b as GuardEngineOptions, P as PlanDefinition,
|
|
2
|
-
import {
|
|
1
|
+
import { a as GuardVerdict, b as GuardEngineOptions, P as PlanDefinition, 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
|
* NeuroVerse Adapter — OpenClaw
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
NeuroVersePlugin,
|
|
4
4
|
createNeuroVersePlugin,
|
|
5
5
|
createNeuroVersePluginFromWorld
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-A7SHG75T.js";
|
|
7
7
|
import "../chunk-5U2MQO5P.js";
|
|
8
|
-
import "../chunk-
|
|
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
|
GovernanceBlockedError,
|
|
@@ -1,12 +1,12 @@
|
|
|
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-A7GKPPU7.js";
|
|
9
|
-
import "./chunk-W7LLXRGY.js";
|
|
9
|
+
import "./chunk-ZAF6JH23.js";
|
|
10
10
|
import "./chunk-QLPTHTVB.js";
|
|
11
11
|
import "./chunk-QWGCMQQD.js";
|
|
12
12
|
|
|
@@ -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-EMQDLDAF.js";
|
|
7
4
|
import {
|
|
8
5
|
emitWorldDefinition
|
|
9
|
-
} from "./chunk-
|
|
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
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bootstrap Contract — Markdown → WorldDefinition Compilation Types
|
|
3
|
+
*
|
|
4
|
+
* Defines the input/output contract for `neuroverse bootstrap`.
|
|
5
|
+
*
|
|
6
|
+
* Input: .nv-world.md file (structured markdown)
|
|
7
|
+
* Output: WorldDefinition (passed to validate, guard, or compileWorldToZip)
|
|
8
|
+
*
|
|
9
|
+
* The markdown format is:
|
|
10
|
+
* - YAML frontmatter for world identity and metadata
|
|
11
|
+
* - H1 sections for each block (Thesis, Invariants, State, etc.)
|
|
12
|
+
* - Structured sub-sections within each block
|
|
13
|
+
* - Deterministically parseable — no LLM, no heuristics
|
|
14
|
+
*
|
|
15
|
+
* Exit codes:
|
|
16
|
+
* 0 = SUCCESS (compiled cleanly)
|
|
17
|
+
* 1 = FAIL (parse errors, missing required sections)
|
|
18
|
+
* 3 = ERROR (file not found, invalid input)
|
|
19
|
+
*/
|
|
20
|
+
type ParseSeverity = 'error' | 'warning' | 'info';
|
|
21
|
+
/**
|
|
22
|
+
* A single parse issue found during markdown compilation.
|
|
23
|
+
*/
|
|
24
|
+
interface ParseIssue {
|
|
25
|
+
/** Line number in the source markdown (1-based) */
|
|
26
|
+
line: number;
|
|
27
|
+
/** Which section the issue was found in */
|
|
28
|
+
section: string;
|
|
29
|
+
/** Human-readable message */
|
|
30
|
+
message: string;
|
|
31
|
+
/** Severity */
|
|
32
|
+
severity: ParseSeverity;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The result of parsing a .nv-world.md file.
|
|
36
|
+
*/
|
|
37
|
+
interface BootstrapResult {
|
|
38
|
+
/** Whether compilation succeeded (no errors) */
|
|
39
|
+
success: boolean;
|
|
40
|
+
/** Source file path */
|
|
41
|
+
sourcePath: string;
|
|
42
|
+
/** All parse issues */
|
|
43
|
+
issues: ParseIssue[];
|
|
44
|
+
/** Parsed sections (for debugging) */
|
|
45
|
+
parsedSections: string[];
|
|
46
|
+
/** Duration */
|
|
47
|
+
durationMs: number;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* YAML frontmatter parsed from the markdown header.
|
|
51
|
+
*/
|
|
52
|
+
interface ParsedFrontmatter {
|
|
53
|
+
world_id: string;
|
|
54
|
+
name: string;
|
|
55
|
+
version?: string;
|
|
56
|
+
runtime_mode?: string;
|
|
57
|
+
default_profile?: string;
|
|
58
|
+
alternative_profile?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A parsed invariant from the Invariants section.
|
|
62
|
+
*/
|
|
63
|
+
interface ParsedInvariant {
|
|
64
|
+
id: string;
|
|
65
|
+
label: string;
|
|
66
|
+
enforcement: string;
|
|
67
|
+
mutable: boolean;
|
|
68
|
+
line: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A parsed state variable from the State section.
|
|
72
|
+
*/
|
|
73
|
+
interface ParsedStateVariable {
|
|
74
|
+
id: string;
|
|
75
|
+
type: 'number' | 'enum' | 'boolean';
|
|
76
|
+
default: string | number | boolean;
|
|
77
|
+
label: string;
|
|
78
|
+
description: string;
|
|
79
|
+
min?: number;
|
|
80
|
+
max?: number;
|
|
81
|
+
step?: number;
|
|
82
|
+
options?: string[];
|
|
83
|
+
line: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* A parsed assumption profile from the Assumptions section.
|
|
87
|
+
*/
|
|
88
|
+
interface ParsedAssumptionProfile {
|
|
89
|
+
id: string;
|
|
90
|
+
name: string;
|
|
91
|
+
description: string;
|
|
92
|
+
parameters: Record<string, string | number | boolean>;
|
|
93
|
+
line: number;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* A parsed trigger from a rule.
|
|
97
|
+
*/
|
|
98
|
+
interface ParsedTrigger {
|
|
99
|
+
field: string;
|
|
100
|
+
operator: string;
|
|
101
|
+
value: string | number | boolean;
|
|
102
|
+
source: 'state' | 'assumption';
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* A parsed effect from a rule.
|
|
106
|
+
*/
|
|
107
|
+
interface ParsedEffect {
|
|
108
|
+
target: string;
|
|
109
|
+
operation: string;
|
|
110
|
+
value: number | boolean | string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* A parsed rule from the Rules section.
|
|
114
|
+
*/
|
|
115
|
+
interface ParsedRule {
|
|
116
|
+
id: string;
|
|
117
|
+
label: string;
|
|
118
|
+
severity: string;
|
|
119
|
+
description?: string;
|
|
120
|
+
order: number;
|
|
121
|
+
triggers: ParsedTrigger[];
|
|
122
|
+
effects: ParsedEffect[];
|
|
123
|
+
collapse_check?: {
|
|
124
|
+
field: string;
|
|
125
|
+
operator: string;
|
|
126
|
+
value: number;
|
|
127
|
+
};
|
|
128
|
+
causal_translation?: {
|
|
129
|
+
trigger_text: string;
|
|
130
|
+
rule_text: string;
|
|
131
|
+
shift_text: string;
|
|
132
|
+
effect_text: string;
|
|
133
|
+
};
|
|
134
|
+
line: number;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* A parsed gate from the Gates section.
|
|
138
|
+
*/
|
|
139
|
+
interface ParsedGate {
|
|
140
|
+
status: string;
|
|
141
|
+
field: string;
|
|
142
|
+
operator: string;
|
|
143
|
+
value: number;
|
|
144
|
+
line: number;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* A parsed outcome from the Outcomes section.
|
|
148
|
+
*/
|
|
149
|
+
interface ParsedOutcome {
|
|
150
|
+
id: string;
|
|
151
|
+
type: string;
|
|
152
|
+
range?: [number, number];
|
|
153
|
+
display?: string;
|
|
154
|
+
label: string;
|
|
155
|
+
primary?: boolean;
|
|
156
|
+
assignment?: string;
|
|
157
|
+
line: number;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* A parsed lens directive from the Lenses section.
|
|
161
|
+
*/
|
|
162
|
+
interface ParsedLensDirective {
|
|
163
|
+
id: string;
|
|
164
|
+
scope: string;
|
|
165
|
+
instruction: string;
|
|
166
|
+
line: number;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* A parsed lens from the Lenses section.
|
|
170
|
+
* Each lens is an H2 subsection with key-value properties and directives.
|
|
171
|
+
*/
|
|
172
|
+
interface ParsedLens {
|
|
173
|
+
id: string;
|
|
174
|
+
name: string;
|
|
175
|
+
tagline: string;
|
|
176
|
+
description: string;
|
|
177
|
+
tags: string[];
|
|
178
|
+
/** Tone: formality, verbosity, emotion, confidence */
|
|
179
|
+
formality: string;
|
|
180
|
+
verbosity: string;
|
|
181
|
+
emotion: string;
|
|
182
|
+
confidence: string;
|
|
183
|
+
/** Which roles this lens is the default for */
|
|
184
|
+
defaultForRoles: string[];
|
|
185
|
+
/** Behavioral directives */
|
|
186
|
+
directives: ParsedLensDirective[];
|
|
187
|
+
/** Priority when stacking (higher = applied later) */
|
|
188
|
+
priority: number;
|
|
189
|
+
/** Whether it can be stacked with other lenses */
|
|
190
|
+
stackable: boolean;
|
|
191
|
+
line: number;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* The full parsed intermediate representation.
|
|
195
|
+
*/
|
|
196
|
+
interface ParsedWorld {
|
|
197
|
+
frontmatter: ParsedFrontmatter;
|
|
198
|
+
thesis: string;
|
|
199
|
+
invariants: ParsedInvariant[];
|
|
200
|
+
stateVariables: ParsedStateVariable[];
|
|
201
|
+
assumptions: ParsedAssumptionProfile[];
|
|
202
|
+
rules: ParsedRule[];
|
|
203
|
+
gates: ParsedGate[];
|
|
204
|
+
outcomes: ParsedOutcome[];
|
|
205
|
+
lenses: ParsedLens[];
|
|
206
|
+
lensPolicy?: 'locked' | 'role_default' | 'user_choice';
|
|
207
|
+
lensLockPin?: string;
|
|
208
|
+
}
|
|
209
|
+
declare const BOOTSTRAP_EXIT_CODES: {
|
|
210
|
+
readonly SUCCESS: 0;
|
|
211
|
+
readonly FAIL: 1;
|
|
212
|
+
readonly ERROR: 3;
|
|
213
|
+
};
|
|
214
|
+
type BootstrapExitCode = (typeof BOOTSTRAP_EXIT_CODES)[keyof typeof BOOTSTRAP_EXIT_CODES];
|
|
215
|
+
|
|
216
|
+
export { BOOTSTRAP_EXIT_CODES as B, type ParsedWorld as P, type ParseIssue as a, type BootstrapExitCode as b, type BootstrapResult as c, type ParsedAssumptionProfile as d, type ParsedEffect as e, type ParsedFrontmatter as f, type ParsedGate as g, type ParsedInvariant as h, type ParsedOutcome as i, type ParsedRule as j, type ParsedStateVariable as k, type ParsedTrigger as l };
|