@neuroverseos/nv-sim 0.1.9 → 0.1.10
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 +90 -3
- package/connectors/nv_mirofish_wrapper.py +841 -0
- package/connectors/nv_scienceclaw_wrapper.py +453 -0
- package/dist/adapters/scienceclaw.js +52 -2
- package/dist/assets/index-B43_0HyO.css +1 -0
- package/dist/assets/index-CdghpsS8.js +595 -0
- package/dist/assets/{reportEngine-D2ZrMny8.js → reportEngine-CYSZfooa.js} +1 -1
- package/dist/connectors/nv-scienceclaw-post.js +376 -0
- package/dist/engine/aiProvider.js +82 -3
- package/dist/engine/analyzer.js +12 -24
- package/dist/engine/cli.js +89 -114
- package/dist/engine/dynamicsGovernance.js +4 -0
- package/dist/engine/fullGovernedLoop.js +16 -1
- package/dist/engine/goalEngine.js +3 -4
- package/dist/engine/governance.js +18 -0
- package/dist/engine/index.js +19 -28
- package/dist/engine/intentTranslator.js +281 -0
- package/dist/engine/liveAdapter.js +100 -18
- package/dist/engine/liveVisualizer.js +2071 -1023
- package/dist/engine/primeRadiant.js +2 -8
- package/dist/engine/reasoningEngine.js +2 -7
- package/dist/engine/scenarioCapsule.js +5 -5
- package/dist/engine/swarmSimulation.js +1 -9
- package/dist/engine/worldBridge.js +22 -8
- package/dist/index.html +2 -2
- package/dist/lib/reasoningEngine.js +17 -1
- package/dist/lib/simulationAdapter.js +11 -11
- package/dist/lib/swarmParser.js +1 -1
- package/dist/runtime/govern.js +160 -7
- package/dist/runtime/index.js +1 -4
- package/dist/runtime/types.js +91 -0
- package/package.json +23 -6
- package/dist/adapters/mirofish.js +0 -461
- package/dist/assets/index-B64NuIXu.css +0 -1
- package/dist/assets/index-BMkPevVr.js +0 -532
- package/dist/assets/mirotir-logo-DUexumBH.svg +0 -185
- package/dist/engine/mirofish.js +0 -295
package/dist/engine/cli.js
CHANGED
|
@@ -280,7 +280,7 @@ async function main() {
|
|
|
280
280
|
process.exit(1);
|
|
281
281
|
}
|
|
282
282
|
console.log("\n NV-SIM — Analyzing simulation...\n");
|
|
283
|
-
const result = await (0, analyzer_1.
|
|
283
|
+
const result = await (0, analyzer_1.analyzeSimulation)({
|
|
284
284
|
simulation: input,
|
|
285
285
|
question: args[2],
|
|
286
286
|
});
|
|
@@ -450,7 +450,7 @@ async function main() {
|
|
|
450
450
|
}
|
|
451
451
|
case "run": {
|
|
452
452
|
// Run an external simulator with governance
|
|
453
|
-
const simId = args[1] ?? "
|
|
453
|
+
const simId = args[1] ?? "nv-sim";
|
|
454
454
|
const runPort = args.includes("--port") ? parseInt(args[args.indexOf("--port") + 1], 10) : 3456;
|
|
455
455
|
const noViewer = args.includes("--no-viewer");
|
|
456
456
|
console.log(`\n NV-SIM — Governed Simulation Runner\n`);
|
|
@@ -896,109 +896,6 @@ async function main() {
|
|
|
896
896
|
break;
|
|
897
897
|
}
|
|
898
898
|
// ============================================
|
|
899
|
-
// MIROFISH — Governed Agent Simulation
|
|
900
|
-
// ============================================
|
|
901
|
-
case "mirofish": {
|
|
902
|
-
console.log(`\n MIROFISH SIMULATION — Governed by NeuroVerse\n`);
|
|
903
|
-
console.log(` MiroFish + NeuroVerse Governance Layer`);
|
|
904
|
-
console.log(` MiroFish generates emergent agent behavior.`);
|
|
905
|
-
console.log(` NeuroVerse enforces rules, constraints, and system stability in real time.\n`);
|
|
906
|
-
console.log(" " + "=".repeat(60));
|
|
907
|
-
const { runMiroFishComparison } = await Promise.resolve().then(() => __importStar(require("../adapters/mirofish")));
|
|
908
|
-
const mfMode = args.includes("--compare") ? "compare" : "governed";
|
|
909
|
-
if (mfMode === "compare") {
|
|
910
|
-
console.log(` Mode: GOVERNED vs UNGOVERNED COMPARISON\n`);
|
|
911
|
-
console.log(` Running simulation...`);
|
|
912
|
-
const comparison = runMiroFishComparison();
|
|
913
|
-
const gov = comparison.governed;
|
|
914
|
-
const ungov = comparison.ungoverned;
|
|
915
|
-
const gs = gov.metrics.systemState;
|
|
916
|
-
const us = ungov.metrics.systemState;
|
|
917
|
-
console.log(`\n Scenario: ${comparison.scenario}`);
|
|
918
|
-
console.log(" " + "=".repeat(60));
|
|
919
|
-
// Metric comparison
|
|
920
|
-
console.log(`\n ${"Metric".padEnd(30)} ${"Governed".padEnd(15)} ${"Ungoverned".padEnd(15)} ${"Delta"}`);
|
|
921
|
-
console.log(" " + "-".repeat(75));
|
|
922
|
-
const mfMetrics = [
|
|
923
|
-
["Trust", gs.trust, us.trust],
|
|
924
|
-
["Polarization", gs.polarization, us.polarization],
|
|
925
|
-
["Outrage", gs.outrage, us.outrage],
|
|
926
|
-
["Cascade Risk", gs.cascadeRisk, us.cascadeRisk],
|
|
927
|
-
["Amplification", gs.amplification, us.amplification],
|
|
928
|
-
];
|
|
929
|
-
for (const [label, gv, uv] of mfMetrics) {
|
|
930
|
-
const delta = gv - uv;
|
|
931
|
-
const deltaStr = `${delta > 0 ? "+" : ""}${(delta * 100).toFixed(0)}`;
|
|
932
|
-
console.log(` ${label.padEnd(30)} ${(gv * 100).toFixed(0).padStart(5)}% ${(uv * 100).toFixed(0).padStart(5)}% ${deltaStr.padStart(5)}`);
|
|
933
|
-
}
|
|
934
|
-
console.log(`\n ${"".padEnd(30)} ${"Governed".padEnd(15)} ${"Ungoverned"}`);
|
|
935
|
-
console.log(" " + "-".repeat(60));
|
|
936
|
-
console.log(` ${"Verdict".padEnd(30)} ${gov.verdict.padEnd(15)} ${ungov.verdict}`);
|
|
937
|
-
console.log(` ${"Actions Blocked".padEnd(30)} ${String(gov.totalBlocked).padEnd(15)} ${0}`);
|
|
938
|
-
console.log(` ${"Actions Modified".padEnd(30)} ${String(gov.totalModified).padEnd(15)} ${0}`);
|
|
939
|
-
console.log(` ${"Trajectory".padEnd(30)} ${gov.metrics.trajectory.padEnd(15)} ${ungov.metrics.trajectory}`);
|
|
940
|
-
// State timeline
|
|
941
|
-
console.log(`\n STATE EVOLUTION (Trust)`);
|
|
942
|
-
console.log(" " + "-".repeat(60));
|
|
943
|
-
console.log(` ${"Round".padEnd(8)} ${"Governed".padEnd(15)} ${"Ungoverned".padEnd(15)} ${"Gap"}`);
|
|
944
|
-
for (let i = 0; i < gov.timeline.length; i++) {
|
|
945
|
-
const gt = gov.timeline[i].systemState.trust;
|
|
946
|
-
const ut = ungov.timeline[i].systemState.trust;
|
|
947
|
-
const gap = gt - ut;
|
|
948
|
-
console.log(` ${String(i + 1).padEnd(8)} ${(gt * 100).toFixed(0).padStart(5)}% ${(ut * 100).toFixed(0).padStart(5)}% ${(gap > 0 ? "+" : "") + (gap * 100).toFixed(0).padStart(4)}`);
|
|
949
|
-
}
|
|
950
|
-
// Science state comparison
|
|
951
|
-
const govSci = gov.metrics.scienceState;
|
|
952
|
-
const ungovSci = ungov.metrics.scienceState;
|
|
953
|
-
console.log(`\n SYSTEM ASSESSMENT`);
|
|
954
|
-
console.log(" " + "-".repeat(60));
|
|
955
|
-
console.log(` Governed: ${govSci.overallAssessment}`);
|
|
956
|
-
console.log(` Ungoverned: ${ungovSci.overallAssessment}`);
|
|
957
|
-
console.log(`\n This simulation was generated by MiroFish.`);
|
|
958
|
-
console.log(` NeuroVerse governance altered the system trajectory in real time.`);
|
|
959
|
-
}
|
|
960
|
-
else {
|
|
961
|
-
// Single governed run
|
|
962
|
-
console.log(` Mode: GOVERNED SIMULATION\n`);
|
|
963
|
-
const { createMiroFishWrapper, generateDemoSimulation } = await Promise.resolve().then(() => __importStar(require("../adapters/mirofish")));
|
|
964
|
-
const demo = generateDemoSimulation();
|
|
965
|
-
const wrapper = createMiroFishWrapper({ enabled: true });
|
|
966
|
-
console.log(` Scenario: ${demo.scenario}\n`);
|
|
967
|
-
for (let i = 0; i < demo.rounds.length; i++) {
|
|
968
|
-
const round = demo.rounds[i];
|
|
969
|
-
let blocked = 0;
|
|
970
|
-
let modified = 0;
|
|
971
|
-
const approved = [];
|
|
972
|
-
for (const action of round) {
|
|
973
|
-
const result = wrapper.interceptAction(action);
|
|
974
|
-
if (result.wasBlocked)
|
|
975
|
-
blocked++;
|
|
976
|
-
else if (result.wasModified)
|
|
977
|
-
modified++;
|
|
978
|
-
if (!result.wasBlocked)
|
|
979
|
-
approved.push(result.governed ?? action);
|
|
980
|
-
}
|
|
981
|
-
const cycleResult = wrapper.completeCycle({ cycle: i + 1, actions: approved });
|
|
982
|
-
const m = wrapper.getMetrics();
|
|
983
|
-
const flags = blocked > 0 ? ` [${blocked} blocked]` : "";
|
|
984
|
-
console.log(` Round ${String(i + 1).padEnd(3)} | trust: ${(m.systemState.trust * 100).toFixed(0).padStart(3)}% | cascade: ${(m.systemState.cascadeRisk * 100).toFixed(0).padStart(3)}% | ${cycleResult.trajectory}${flags}`);
|
|
985
|
-
}
|
|
986
|
-
const final = wrapper.getMetrics();
|
|
987
|
-
console.log(`\n FINAL STATE`);
|
|
988
|
-
console.log(" " + "=".repeat(50));
|
|
989
|
-
console.log(` Trust: ${(final.systemState.trust * 100).toFixed(0)}%`);
|
|
990
|
-
console.log(` Cascade Risk: ${(final.systemState.cascadeRisk * 100).toFixed(0)}%`);
|
|
991
|
-
console.log(` Blocked: ${final.actionStats.blocked}`);
|
|
992
|
-
console.log(` Modified: ${final.actionStats.modified}`);
|
|
993
|
-
console.log(` Assessment: ${final.scienceState.overallAssessment}`);
|
|
994
|
-
}
|
|
995
|
-
console.log(`\n ${"=".repeat(60)}`);
|
|
996
|
-
console.log(` Governed MiroFish Simulation | NeuroVerse Governance Layer`);
|
|
997
|
-
console.log(` ${"=".repeat(60)}`);
|
|
998
|
-
console.log(`\n neuroverse-simulations | @neuroverseos\n`);
|
|
999
|
-
break;
|
|
1000
|
-
}
|
|
1001
|
-
// ============================================
|
|
1002
899
|
// SCIENCE — Governed Scientific Discovery
|
|
1003
900
|
// ============================================
|
|
1004
901
|
case "science": {
|
|
@@ -1474,6 +1371,84 @@ async function main() {
|
|
|
1474
1371
|
}
|
|
1475
1372
|
break;
|
|
1476
1373
|
}
|
|
1374
|
+
// ============================================
|
|
1375
|
+
// CONNECT — Connector setup instructions
|
|
1376
|
+
// ============================================
|
|
1377
|
+
case "connect": {
|
|
1378
|
+
const connector = args[1]?.toLowerCase();
|
|
1379
|
+
if (connector === "scienceclaw" || connector === "science") {
|
|
1380
|
+
console.log(`
|
|
1381
|
+
NV-SIM — ScienceClaw Connector Setup
|
|
1382
|
+
|
|
1383
|
+
WHAT THIS DOES:
|
|
1384
|
+
Wraps ScienceClaw's entry point with NeuroVerse governance.
|
|
1385
|
+
ScienceClaw runs unchanged. Governance happens automatically.
|
|
1386
|
+
|
|
1387
|
+
${"=".repeat(60)}
|
|
1388
|
+
|
|
1389
|
+
OPTION 1: Python Wrapper (zero dependencies besides requests)
|
|
1390
|
+
|
|
1391
|
+
# Step 1: Start governance server
|
|
1392
|
+
nv-sim serve
|
|
1393
|
+
|
|
1394
|
+
# Step 2: Run ScienceClaw through the wrapper
|
|
1395
|
+
python connectors/nv_scienceclaw_wrapper.py --agent MyAgent --topic "CRISPR risks"
|
|
1396
|
+
|
|
1397
|
+
# Environment variables:
|
|
1398
|
+
NEUROVERSE_URL=http://localhost:3456 # governance server
|
|
1399
|
+
SCIENCECLAW_BIN=scienceclaw-post # path to scienceclaw binary
|
|
1400
|
+
|
|
1401
|
+
${"=".repeat(60)}
|
|
1402
|
+
|
|
1403
|
+
OPTION 2: Node.js CLI (installed via npm)
|
|
1404
|
+
|
|
1405
|
+
# Step 1: Start governance server
|
|
1406
|
+
nv-sim serve
|
|
1407
|
+
|
|
1408
|
+
# Step 2: Use the drop-in replacement command
|
|
1409
|
+
nv-scienceclaw-post --agent MyAgent --topic "CRISPR risks"
|
|
1410
|
+
|
|
1411
|
+
# Same args as scienceclaw-post — governance is transparent.
|
|
1412
|
+
|
|
1413
|
+
${"=".repeat(60)}
|
|
1414
|
+
|
|
1415
|
+
OPTION 3: Live Process Adapter (real-time governance)
|
|
1416
|
+
|
|
1417
|
+
# Spawns ScienceClaw as a child process, governs each artifact cycle live
|
|
1418
|
+
nv-sim run scienceclaw --args "--agent MyAgent --topic CRISPR"
|
|
1419
|
+
|
|
1420
|
+
${"=".repeat(60)}
|
|
1421
|
+
|
|
1422
|
+
HOW IT WORKS:
|
|
1423
|
+
|
|
1424
|
+
User runs wrapper
|
|
1425
|
+
|
|
|
1426
|
+
Wrapper calls NeuroVerse /api/evaluate
|
|
1427
|
+
|
|
|
1428
|
+
ALLOW/REWARD -> execute scienceclaw-post
|
|
1429
|
+
BLOCK/PENALIZE -> stop, print reason
|
|
1430
|
+
MODIFY -> adjust parameters, then execute
|
|
1431
|
+
|
|
1432
|
+
ScienceClaw is NEVER modified. Governance is external.
|
|
1433
|
+
`);
|
|
1434
|
+
}
|
|
1435
|
+
else {
|
|
1436
|
+
console.log(`
|
|
1437
|
+
NV-SIM — Connectors
|
|
1438
|
+
|
|
1439
|
+
Available connectors:
|
|
1440
|
+
scienceclaw Govern ScienceClaw investigations
|
|
1441
|
+
|
|
1442
|
+
Usage:
|
|
1443
|
+
nv-sim connect scienceclaw # Setup instructions
|
|
1444
|
+
|
|
1445
|
+
Or run directly:
|
|
1446
|
+
nv-sim run scienceclaw # Live process adapter
|
|
1447
|
+
nv-sim serve # Start governance server for any connector
|
|
1448
|
+
`);
|
|
1449
|
+
}
|
|
1450
|
+
break;
|
|
1451
|
+
}
|
|
1477
1452
|
case "help":
|
|
1478
1453
|
case "--help":
|
|
1479
1454
|
case "-h":
|
|
@@ -1502,14 +1477,12 @@ async function main() {
|
|
|
1502
1477
|
serve | govern Start local governance runtime
|
|
1503
1478
|
--port N (default: 3456)
|
|
1504
1479
|
run <simulator> Run external simulator with governance
|
|
1505
|
-
e.g., nv-sim run
|
|
1480
|
+
e.g., nv-sim run scienceclaw
|
|
1506
1481
|
radiant [preset] Prime Radiant — full policy enforcement system
|
|
1507
1482
|
Dual-layer: govern() + governDynamics()
|
|
1508
1483
|
--world MODE 1: build & validate world
|
|
1509
1484
|
--compare MODE 3: decision intelligence (N options)
|
|
1510
1485
|
(default) MODE 2: governed simulation with comparison
|
|
1511
|
-
mirofish MiroFish agent simulation with governance
|
|
1512
|
-
--compare Governed vs ungoverned comparison
|
|
1513
1486
|
science Science mode — governed autonomous discovery
|
|
1514
1487
|
--compare Governed vs ungoverned comparison
|
|
1515
1488
|
world-from-doc <file> Generate world rules from a document
|
|
@@ -1539,7 +1512,7 @@ async function main() {
|
|
|
1539
1512
|
npx nv-sim chaos --runs 500 # Stress test (500 runs)
|
|
1540
1513
|
npx nv-sim visualize # Live viewer in browser
|
|
1541
1514
|
npx nv-sim serve # Start local governance runtime
|
|
1542
|
-
npx nv-sim run
|
|
1515
|
+
npx nv-sim run scienceclaw # Run ScienceClaw with governance
|
|
1543
1516
|
npx nv-sim compare strait_of_hormuz # Geopolitical demo
|
|
1544
1517
|
npx nv-sim compare --inject tanker_explosion@3 # With narrative shock
|
|
1545
1518
|
npx nv-sim compare --inject rate_cut@3,sanctions@5
|
|
@@ -1568,16 +1541,18 @@ async function main() {
|
|
|
1568
1541
|
npx nv-sim radiant geopolitical_crisis --world # World builder mode
|
|
1569
1542
|
npx nv-sim radiant scientific_discovery # Science discovery preset
|
|
1570
1543
|
|
|
1571
|
-
MIROFISH MODE:
|
|
1572
|
-
|
|
1573
|
-
npx nv-sim mirofish # Governed agent simulation
|
|
1574
|
-
npx nv-sim mirofish --compare # Governed vs ungoverned comparison
|
|
1575
|
-
|
|
1576
1544
|
SCIENCE MODE:
|
|
1577
1545
|
|
|
1578
1546
|
npx nv-sim science # Governed investigation demo
|
|
1579
1547
|
npx nv-sim science --compare # Governed vs ungoverned comparison
|
|
1580
1548
|
|
|
1549
|
+
CONNECTORS (wrap external simulators with governance):
|
|
1550
|
+
|
|
1551
|
+
npx nv-sim connect scienceclaw # Setup instructions
|
|
1552
|
+
npx nv-sim run scienceclaw # Live process adapter
|
|
1553
|
+
nv-scienceclaw-post --agent X --topic "Y" # Drop-in CLI wrapper
|
|
1554
|
+
python connectors/nv_scienceclaw_wrapper.py # Python wrapper
|
|
1555
|
+
|
|
1581
1556
|
Design rules. Run reality. See what changes.
|
|
1582
1557
|
`);
|
|
1583
1558
|
break;
|
|
@@ -188,6 +188,8 @@ function parseDynamicsRules(policyText) {
|
|
|
188
188
|
// ============================================
|
|
189
189
|
function createDynamicsGovernor(policyText, initialState, options) {
|
|
190
190
|
const dynamicsRules = options?.skipRules ? [] : parseDynamicsRules(policyText);
|
|
191
|
+
// Per-agent incentive stats at the dynamics level
|
|
192
|
+
const agentIncentiveStats = new Map();
|
|
191
193
|
let state = {
|
|
192
194
|
polarization: 0.1,
|
|
193
195
|
outrage: 0.1,
|
|
@@ -537,6 +539,7 @@ function createDynamicsGovernor(policyText, initialState, options) {
|
|
|
537
539
|
history: [],
|
|
538
540
|
...initialState,
|
|
539
541
|
};
|
|
542
|
+
agentIncentiveStats.clear();
|
|
540
543
|
stats.totalRounds = 0;
|
|
541
544
|
stats.totalInterventions = 0;
|
|
542
545
|
stats.propagationLimits = 0;
|
|
@@ -555,6 +558,7 @@ function createDynamicsGovernor(policyText, initialState, options) {
|
|
|
555
558
|
/** Mutate the internal state directly (used by adapters for governance feedback) */
|
|
556
559
|
mutateState(fn) { fn(state); },
|
|
557
560
|
get rules() { return [...dynamicsRules]; },
|
|
561
|
+
get agentIncentiveStats() { return agentIncentiveStats; },
|
|
558
562
|
get stats() {
|
|
559
563
|
return {
|
|
560
564
|
totalRounds: stats.totalRounds,
|
|
@@ -28,7 +28,7 @@ const narrativeInjection_1 = require("./narrativeInjection");
|
|
|
28
28
|
/**
|
|
29
29
|
* Convert a SwarmAgentReaction into an AgentAction for govern().
|
|
30
30
|
*
|
|
31
|
-
* This is the bridge between
|
|
31
|
+
* This is the bridge between Swarm output and NeuroVerse governance.
|
|
32
32
|
* It infers action type, magnitude, and description from the reaction content.
|
|
33
33
|
*/
|
|
34
34
|
function reactionToAction(reaction) {
|
|
@@ -91,6 +91,21 @@ function applyVerdictToReaction(reaction, verdict) {
|
|
|
91
91
|
confidence: Number(reaction.confidence.toFixed(3)),
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
+
if (verdict.status === "PENALIZE") {
|
|
95
|
+
// Penalized agents get blocked AND frozen — stronger than BLOCK
|
|
96
|
+
return {
|
|
97
|
+
...reaction,
|
|
98
|
+
impact: 0,
|
|
99
|
+
confidence: Number((Math.max(0.01, reaction.confidence * 0.1)).toFixed(3)),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
if (verdict.status === "REWARD") {
|
|
103
|
+
// Rewarded agents get a confidence boost — positive reinforcement
|
|
104
|
+
return {
|
|
105
|
+
...reaction,
|
|
106
|
+
confidence: Number((Math.min(1, reaction.confidence * 1.3)).toFixed(3)),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
94
109
|
// ALLOW — no change
|
|
95
110
|
return reaction;
|
|
96
111
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* from the goal to generate candidate strategies, then tests each one
|
|
9
9
|
* against the swarm simulation to rank feasibility.
|
|
10
10
|
*
|
|
11
|
-
* Two modes of
|
|
11
|
+
* Two modes of NeuroVerse:
|
|
12
12
|
* EXPLORE: "What might happen?" → forward simulation → discovery
|
|
13
13
|
* GOAL: "How do I get here?" → backward reasoning → strategy design
|
|
14
14
|
*
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
*/
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
34
|
exports.runGoalReasoning = runGoalReasoning;
|
|
35
|
-
const
|
|
35
|
+
const swarmSimulation_1 = require("./swarmSimulation");
|
|
36
36
|
// ============================================
|
|
37
37
|
// LEVER INFERENCE
|
|
38
38
|
// ============================================
|
|
@@ -409,8 +409,7 @@ async function testStrategyAgainstSwarm(strategy, scenario, goal, stakeholders,
|
|
|
409
409
|
harms_stakeholders: strategy.likely_opponents,
|
|
410
410
|
};
|
|
411
411
|
// Run the simulation
|
|
412
|
-
const
|
|
413
|
-
const result = unified.result;
|
|
412
|
+
const result = await (0, swarmSimulation_1.runSwarmSimulation)(strategyScenario, stakeholders, [strategyPath], swarmConfig);
|
|
414
413
|
// Evaluate goal proximity from swarm results
|
|
415
414
|
const avgImpact = result.rounds.length > 0
|
|
416
415
|
? result.rounds[result.rounds.length - 1].reactions.reduce((s, r) => s + r.impact, 0) / result.rounds[result.rounds.length - 1].reactions.length
|
|
@@ -129,6 +129,24 @@ function runFullGovernanceChecks(request, worldLite) {
|
|
|
129
129
|
detail: `Guard paused: ${guardVerdict.reason ?? "Review recommended"}. Continuing in advisory mode.`,
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
|
+
// If guard penalizes, note it with consequence details
|
|
133
|
+
if (guardVerdict.status === "PENALIZE") {
|
|
134
|
+
results.push({
|
|
135
|
+
rule_id: "NV-PENALIZE",
|
|
136
|
+
rule: "NeuroverseOS guard issued PENALIZE — agent penalized",
|
|
137
|
+
passed: false,
|
|
138
|
+
detail: `Guard penalized: ${guardVerdict.consequence?.description ?? guardVerdict.reason ?? "Action penalized by guard"}. Agent frozen for ${guardVerdict.consequence?.rounds ?? 1} round(s). Continuing in advisory mode.`,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
// If guard rewards, note it with reward details
|
|
142
|
+
if (guardVerdict.status === "REWARD") {
|
|
143
|
+
results.push({
|
|
144
|
+
rule_id: "NV-REWARD",
|
|
145
|
+
rule: "NeuroverseOS guard issued REWARD — agent rewarded",
|
|
146
|
+
passed: true,
|
|
147
|
+
detail: `Guard rewarded: ${guardVerdict.reward?.description ?? guardVerdict.reason ?? "Action rewarded by guard"}. Agent influence boosted.`,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
132
150
|
}
|
|
133
151
|
catch (error) {
|
|
134
152
|
// If NeuroverseOS evaluation fails, log and continue with Echelon checks
|
package/dist/engine/index.js
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* NeuroVerse — Governed Discovery Engine
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* applications, and the Mirotir UI all consume.
|
|
5
|
+
* Public exports for the reasoning and governance infrastructure.
|
|
6
|
+
* Built on @neuroverseos/governance (open source).
|
|
8
7
|
*
|
|
9
8
|
* Architecture:
|
|
10
|
-
*
|
|
11
|
-
* Autonomous agents
|
|
12
|
-
* Third-party apps
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
9
|
+
* NeuroVerse UI ──→ POST /reason ──→ Echelon kernel (proprietary)
|
|
10
|
+
* Autonomous agents ──→ POST /reason ──→ Echelon kernel
|
|
11
|
+
* Third-party apps ──→ POST /reason ──→ Echelon kernel
|
|
12
|
+
* ScienceClaw / any swarm ──→ POST /reason ──→ Echelon kernel
|
|
13
|
+
* │
|
|
14
|
+
* ├── Governance traces (open, auditable)
|
|
15
|
+
* ├── Swarm simulation (native or external)
|
|
16
|
+
* ├── World files (NeuroverseOS governance models)
|
|
17
|
+
* ├── Intent translator (NL → rules)
|
|
18
|
+
* └── Scenario capsules (shareable, portable)
|
|
19
19
|
*
|
|
20
|
-
*
|
|
21
|
-
* Mirotir helps you decide WHAT TO DO → the brain
|
|
20
|
+
* Scientists define what matters → governance enforces it → agents operate within bounds.
|
|
22
21
|
*/
|
|
23
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.
|
|
25
|
-
exports.EXAMPLE_WORLD_STATES = exports.EXAMPLE_ACTIONS = exports.createGovernor = exports.govern = exports.extractTrace = exports.generateGovernedReport = exports.formatAuditTrail = exports.searchAuditTrails = exports.loadAuditSession = exports.listAuditSessions = exports.AuditTrail = exports.evaluateAIAction = exports.listAIProviders = exports.getDefaultProviderName = exports.getAIProvider = exports.registerAIProvider = exports.generateAIReaction = exports.generateDeterministicReport = exports.OpenAICompatibleProvider = exports.AnthropicProvider = exports.DeterministicProvider = exports.AI_ROLES =
|
|
23
|
+
exports.parseReasonRequestBody = exports.handleRunPreset = exports.handleGetPreset = exports.handleListPresets = exports.handleHealthCheck = exports.handleCreateCapsule = exports.handleReasonFromCapsule = exports.handleReasonRequest = exports.applyQuickFix = exports.runPolicyPipeline = exports.policyToWorld = exports.validatePolicy = exports.parseRulesFromText = exports.suggestExperiments = exports.formatPolicyDiagnostics = exports.formatGuidedNextSteps = exports.exportEnforcementReportJSON = exports.formatEnforcementReport = exports.createEnforcementSession = exports.formatCrossRunComparison = exports.formatBehavioralAnalysis = exports.compareBehaviorAcrossRuns = exports.detectBehavioralShifts = exports.computeActionDistributions = exports.buildAgentTrajectories = exports.classifyBehavior = exports.analyzeBehavior = exports.runGovernedComparison = exports.analyzeSimulation = exports.runSwarmSimulation = exports.initNeuroverseModule = exports.validationToEnforcedConstraints = exports.simulationToGovernanceSignals = exports.verdictToConstitutionalChecks = exports.validateScenarioWorld = exports.runWorldSimulation = exports.evaluateScenarioGuard = exports.buildWorldFromScenario = exports.runFullGovernanceChecks = exports.runGovernanceChecks = exports.processReasonRequest = exports.SCENARIO_TEMPLATES = exports.getPresetCapsule = exports.extractCapsuleFromUrl = exports.buildShareableUrl = exports.decodeCapsule = exports.encodeCapsule = exports.capsuleToReasonRequest = exports.createCapsule = exports.runGoalReasoning = void 0;
|
|
24
|
+
exports.EXAMPLE_WORLD_STATES = exports.EXAMPLE_ACTIONS = exports.createGovernor = exports.govern = exports.extractTrace = exports.generateGovernedReport = exports.translateIntent = exports.formatAuditTrail = exports.searchAuditTrails = exports.loadAuditSession = exports.listAuditSessions = exports.AuditTrail = exports.evaluateAIAction = exports.listAIProviders = exports.getDefaultProviderName = exports.getAIProvider = exports.registerAIProvider = exports.generateAIReaction = exports.generateDeterministicReport = exports.OpenAICompatibleProvider = exports.AnthropicProvider = exports.DeterministicProvider = exports.AI_ROLES = void 0;
|
|
26
25
|
// Goal-Directed Strategy Engine
|
|
27
26
|
var goalEngine_1 = require("./goalEngine");
|
|
28
27
|
Object.defineProperty(exports, "runGoalReasoning", { enumerable: true, get: function () { return goalEngine_1.runGoalReasoning; } });
|
|
@@ -56,18 +55,8 @@ Object.defineProperty(exports, "initNeuroverseModule", { enumerable: true, get:
|
|
|
56
55
|
// Swarm Simulation (Echelon-native)
|
|
57
56
|
var swarmSimulation_1 = require("./swarmSimulation");
|
|
58
57
|
Object.defineProperty(exports, "runSwarmSimulation", { enumerable: true, get: function () { return swarmSimulation_1.runSwarmSimulation; } });
|
|
59
|
-
var mirofish_1 = require("./mirofish");
|
|
60
|
-
Object.defineProperty(exports, "MiroFishClient", { enumerable: true, get: function () { return mirofish_1.MiroFishClient; } });
|
|
61
|
-
Object.defineProperty(exports, "MiroFishError", { enumerable: true, get: function () { return mirofish_1.MiroFishError; } });
|
|
62
|
-
Object.defineProperty(exports, "configureMiroFish", { enumerable: true, get: function () { return mirofish_1.configureMiroFish; } });
|
|
63
|
-
Object.defineProperty(exports, "getMiroFishClient", { enumerable: true, get: function () { return mirofish_1.getMiroFishClient; } });
|
|
64
|
-
Object.defineProperty(exports, "runUnifiedSimulation", { enumerable: true, get: function () { return mirofish_1.runUnifiedSimulation; } });
|
|
65
|
-
Object.defineProperty(exports, "stakeholdersToMiroFishAgents", { enumerable: true, get: function () { return mirofish_1.stakeholdersToMiroFishAgents; } });
|
|
66
|
-
Object.defineProperty(exports, "miroFishResultToSwarmResult", { enumerable: true, get: function () { return mirofish_1.miroFishResultToSwarmResult; } });
|
|
67
|
-
Object.defineProperty(exports, "buildMiroFishRequest", { enumerable: true, get: function () { return mirofish_1.buildMiroFishRequest; } });
|
|
68
|
-
Object.defineProperty(exports, "DEFAULT_MIROFISH_CONFIG", { enumerable: true, get: function () { return mirofish_1.DEFAULT_MIROFISH_CONFIG; } });
|
|
69
58
|
var analyzer_1 = require("./analyzer");
|
|
70
|
-
Object.defineProperty(exports, "
|
|
59
|
+
Object.defineProperty(exports, "analyzeSimulation", { enumerable: true, get: function () { return analyzer_1.analyzeSimulation; } });
|
|
71
60
|
var governedSimulation_1 = require("./governedSimulation");
|
|
72
61
|
Object.defineProperty(exports, "runGovernedComparison", { enumerable: true, get: function () { return governedSimulation_1.runGovernedComparison; } });
|
|
73
62
|
var behavioralAnalysis_1 = require("./behavioralAnalysis");
|
|
@@ -120,6 +109,8 @@ Object.defineProperty(exports, "listAuditSessions", { enumerable: true, get: fun
|
|
|
120
109
|
Object.defineProperty(exports, "loadAuditSession", { enumerable: true, get: function () { return auditTrace_1.loadAuditSession; } });
|
|
121
110
|
Object.defineProperty(exports, "searchAuditTrails", { enumerable: true, get: function () { return auditTrace_1.searchAuditTrails; } });
|
|
122
111
|
Object.defineProperty(exports, "formatAuditTrail", { enumerable: true, get: function () { return auditTrace_1.formatAuditTrail; } });
|
|
112
|
+
var intentTranslator_1 = require("./intentTranslator");
|
|
113
|
+
Object.defineProperty(exports, "translateIntent", { enumerable: true, get: function () { return intentTranslator_1.translateIntent; } });
|
|
123
114
|
var reportEngine_1 = require("./reportEngine");
|
|
124
115
|
Object.defineProperty(exports, "generateGovernedReport", { enumerable: true, get: function () { return reportEngine_1.generateGovernedReport; } });
|
|
125
116
|
Object.defineProperty(exports, "extractTrace", { enumerable: true, get: function () { return reportEngine_1.extractTrace; } });
|