@neuroverseos/nv-sim 0.1.2 → 0.1.6
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 +376 -66
- package/dist/adapters/mirofish.js +461 -0
- package/dist/adapters/scienceclaw.js +750 -0
- package/dist/assets/index-CHmUN8s0.js +532 -0
- package/dist/assets/index-DWgMnB7I.css +1 -0
- package/dist/assets/mirotir-logo-DUexumBH.svg +185 -0
- package/dist/assets/reportEngine-BVdQ2_nW.js +1 -0
- package/dist/components/ConstraintsPanel.js +11 -0
- package/dist/components/StakeholderBuilder.js +32 -0
- package/dist/components/ui/badge.js +24 -0
- package/dist/components/ui/button.js +70 -0
- package/dist/components/ui/card.js +57 -0
- package/dist/components/ui/input.js +44 -0
- package/dist/components/ui/label.js +45 -0
- package/dist/components/ui/select.js +70 -0
- package/dist/engine/aiProvider.js +681 -0
- package/dist/engine/auditTrace.js +352 -0
- package/dist/engine/behavioralAnalysis.js +605 -0
- package/dist/engine/cli.js +1408 -299
- package/dist/engine/dynamicsGovernance.js +588 -0
- package/dist/engine/fullGovernedLoop.js +367 -0
- package/dist/engine/governance.js +8 -3
- package/dist/engine/governedSimulation.js +114 -17
- package/dist/engine/index.js +56 -1
- package/dist/engine/liveAdapter.js +342 -0
- package/dist/engine/liveVisualizer.js +3063 -0
- package/dist/engine/metrics/science.metrics.js +335 -0
- package/dist/engine/narrativeInjection.js +305 -0
- package/dist/engine/policyEnforcement.js +1611 -0
- package/dist/engine/policyEngine.js +799 -0
- package/dist/engine/primeRadiant.js +540 -0
- package/dist/engine/reasoningEngine.js +57 -3
- package/dist/engine/reportEngine.js +97 -0
- package/dist/engine/scenarioComparison.js +463 -0
- package/dist/engine/scenarioLibrary.js +231 -0
- package/dist/engine/swarmSimulation.js +54 -1
- package/dist/engine/worldComparison.js +358 -0
- package/dist/engine/worldStorage.js +232 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.html +23 -0
- package/dist/lib/reasoningEngine.js +290 -0
- package/dist/lib/simulationAdapter.js +686 -0
- package/dist/lib/swarmParser.js +291 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/utils.js +8 -0
- package/dist/placeholder.svg +1 -0
- package/dist/robots.txt +14 -0
- package/dist/runtime/govern.js +473 -0
- package/dist/runtime/index.js +75 -0
- package/dist/runtime/types.js +11 -0
- package/package.json +17 -12
- package/variants/.gitkeep +0 -0
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Prime Radiant — The Unified Governance Intelligence Platform
|
|
4
|
+
*
|
|
5
|
+
* "MiroFish simulates how narratives emerge from interacting agents.
|
|
6
|
+
* NeuroverseOS intervenes at the action level to shape how those narratives evolve."
|
|
7
|
+
*
|
|
8
|
+
* Or sharper:
|
|
9
|
+
* "They simulate society. We control how it behaves."
|
|
10
|
+
*
|
|
11
|
+
* The Prime Radiant operates in three modes:
|
|
12
|
+
*
|
|
13
|
+
* MODE 1: WORLD BUILDER
|
|
14
|
+
* Merge knowledge graph (MiroFish) + policy constraints (NeuroverseOS)
|
|
15
|
+
* → Governed world file ready for simulation
|
|
16
|
+
*
|
|
17
|
+
* MODE 2: GOVERNED SIMULATION
|
|
18
|
+
* Run simulations through both governance layers:
|
|
19
|
+
* - Layer A: govern() — per-action, per-agent
|
|
20
|
+
* - Layer B: governDynamics() — per-round, system-level
|
|
21
|
+
* Compare governed vs ungoverned trajectories
|
|
22
|
+
*
|
|
23
|
+
* MODE 3: DECISION INTELLIGENCE
|
|
24
|
+
* Run N scenarios × M policies
|
|
25
|
+
* Score outcomes against user-defined metrics
|
|
26
|
+
* Produce actionable recommendation
|
|
27
|
+
*
|
|
28
|
+
* Usage:
|
|
29
|
+
* const radiant = createPrimeRadiant({
|
|
30
|
+
* scenario: "University crisis...",
|
|
31
|
+
* policyText: "Block inflammatory content. Boost official sources...",
|
|
32
|
+
* })
|
|
33
|
+
*
|
|
34
|
+
* // Mode 1: Build world
|
|
35
|
+
* const world = radiant.buildWorld()
|
|
36
|
+
*
|
|
37
|
+
* // Mode 2: Run governed sim
|
|
38
|
+
* const sim = await radiant.runGovernedSimulation()
|
|
39
|
+
*
|
|
40
|
+
* // Mode 3: Compare options
|
|
41
|
+
* const decision = await radiant.compareOptions([
|
|
42
|
+
* { id: "optionA", label: "Revoke", policyText: "..." },
|
|
43
|
+
* { id: "optionB", label: "Maintain", policyText: "..." },
|
|
44
|
+
* ])
|
|
45
|
+
*/
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.PRIME_RADIANT_PRESETS = void 0;
|
|
48
|
+
exports.createPrimeRadiant = createPrimeRadiant;
|
|
49
|
+
const policyEngine_1 = require("./policyEngine");
|
|
50
|
+
const fullGovernedLoop_1 = require("./fullGovernedLoop");
|
|
51
|
+
const scenarioComparison_1 = require("./scenarioComparison");
|
|
52
|
+
const dynamicsGovernance_1 = require("./dynamicsGovernance");
|
|
53
|
+
const govern_1 = require("../runtime/govern");
|
|
54
|
+
// ============================================
|
|
55
|
+
// DEFAULT STAKEHOLDERS & PATHS
|
|
56
|
+
// ============================================
|
|
57
|
+
function defaultStakeholders() {
|
|
58
|
+
return [
|
|
59
|
+
{ id: "Public", disposition: "neutral", priorities: ["trust", "fairness", "information"] },
|
|
60
|
+
{ id: "Media", disposition: "hostile", priorities: ["story", "audience", "speed"] },
|
|
61
|
+
{ id: "Officials", disposition: "supportive", priorities: ["stability", "legitimacy", "control"] },
|
|
62
|
+
{ id: "Opposition", disposition: "hostile", priorities: ["accountability", "change", "leverage"] },
|
|
63
|
+
{ id: "Affected Parties", disposition: "neutral", priorities: ["justice", "resolution", "voice"] },
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
function defaultPaths() {
|
|
67
|
+
return [
|
|
68
|
+
{
|
|
69
|
+
id: "path_escalation",
|
|
70
|
+
label: "Escalation",
|
|
71
|
+
description: "Situation escalates as narratives spread and positions harden",
|
|
72
|
+
projected_outcome: "Increased polarization, media cycle extends, institutional trust erodes",
|
|
73
|
+
probability: 0.6,
|
|
74
|
+
risk: "high",
|
|
75
|
+
tradeoffs: ["Speed of response vs. quality of response", "Transparency vs. institutional protection"],
|
|
76
|
+
benefits_stakeholders: ["Media"],
|
|
77
|
+
harms_stakeholders: ["Officials", "Affected Parties"],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: "path_containment",
|
|
81
|
+
label: "Containment",
|
|
82
|
+
description: "Governance constraints contain the situation within manageable bounds",
|
|
83
|
+
projected_outcome: "Reduced volatility, shortened media cycle, trust preserved",
|
|
84
|
+
probability: 0.5,
|
|
85
|
+
risk: "moderate",
|
|
86
|
+
tradeoffs: ["Constraint vs. freedom of expression", "Short-term calm vs. suppression perception"],
|
|
87
|
+
benefits_stakeholders: ["Officials", "Public"],
|
|
88
|
+
harms_stakeholders: ["Media"],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: "path_resolution",
|
|
92
|
+
label: "Resolution",
|
|
93
|
+
description: "Active engagement and transparency lead to constructive resolution",
|
|
94
|
+
projected_outcome: "Trust recovery, narrative shifts to institutional learning, opposition de-escalates",
|
|
95
|
+
probability: 0.35,
|
|
96
|
+
risk: "moderate",
|
|
97
|
+
tradeoffs: ["Time investment vs. other priorities", "Admitting fault vs. maintaining position"],
|
|
98
|
+
benefits_stakeholders: ["Affected Parties", "Public"],
|
|
99
|
+
harms_stakeholders: [],
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
// ============================================
|
|
104
|
+
// FACTORY: createPrimeRadiant()
|
|
105
|
+
// ============================================
|
|
106
|
+
function createPrimeRadiant(config) {
|
|
107
|
+
const stakeholders = config.stakeholders ?? defaultStakeholders();
|
|
108
|
+
const paths = config.paths ?? defaultPaths();
|
|
109
|
+
const swarmConfig = config.swarmConfig ?? {
|
|
110
|
+
enabled: true,
|
|
111
|
+
rounds: 8,
|
|
112
|
+
reaction_model: "mixed",
|
|
113
|
+
};
|
|
114
|
+
// Parse policy and build world
|
|
115
|
+
const parsedPolicy = (0, policyEngine_1.parseRulesFromText)(config.policyText);
|
|
116
|
+
const healthCheck = (0, policyEngine_1.validatePolicy)(parsedPolicy);
|
|
117
|
+
const worldDef = config.worldDef ?? (0, policyEngine_1.policyToWorld)(parsedPolicy);
|
|
118
|
+
// Create governors
|
|
119
|
+
const actionGov = (0, govern_1.createGovernor)({
|
|
120
|
+
policyText: config.policyText,
|
|
121
|
+
sensitivity: 0.5,
|
|
122
|
+
});
|
|
123
|
+
const dynamicsGov = (0, dynamicsGovernance_1.createDynamicsGovernor)(config.policyText, config.initialState);
|
|
124
|
+
// --- MODE 1: WORLD BUILDER ---
|
|
125
|
+
function buildWorld() {
|
|
126
|
+
const dynamicsRules = (0, dynamicsGovernance_1.createDynamicsGovernor)(config.policyText).rules;
|
|
127
|
+
const coveredVars = new Set(parsedPolicy.rules.flatMap((r) => r.affectedVariables));
|
|
128
|
+
const criticalVars = ["liquidity", "leverage", "volatility", "risk", "stability", "trust", "contagion"];
|
|
129
|
+
const uncovered = criticalVars.filter((v) => !coveredVars.has(v));
|
|
130
|
+
return {
|
|
131
|
+
policy: parsedPolicy,
|
|
132
|
+
health: healthCheck,
|
|
133
|
+
world: worldDef,
|
|
134
|
+
stakeholders,
|
|
135
|
+
coverageReport: {
|
|
136
|
+
totalRules: parsedPolicy.summary.total,
|
|
137
|
+
enforcedRules: parsedPolicy.summary.enforced,
|
|
138
|
+
advisoryRules: parsedPolicy.summary.advisory,
|
|
139
|
+
coveredVariables: [...coveredVars],
|
|
140
|
+
uncoveredCritical: uncovered,
|
|
141
|
+
dynamicsRulesDetected: dynamicsRules.length,
|
|
142
|
+
healthScore: healthCheck.healthScore,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
// --- MODE 2: GOVERNED SIMULATION ---
|
|
147
|
+
async function runGovernedSim() {
|
|
148
|
+
// Run governed simulation
|
|
149
|
+
const governed = await (0, fullGovernedLoop_1.runFullGovernedSimulation)({
|
|
150
|
+
scenario: config.scenario,
|
|
151
|
+
stakeholders,
|
|
152
|
+
paths,
|
|
153
|
+
swarmConfig,
|
|
154
|
+
policyText: config.policyText,
|
|
155
|
+
worldDef,
|
|
156
|
+
narrativeEvents: config.narrativeEvents,
|
|
157
|
+
agentTypes: config.agentTypes,
|
|
158
|
+
initialSystemState: config.initialState,
|
|
159
|
+
});
|
|
160
|
+
// Run ungoverned baseline (empty policy)
|
|
161
|
+
const baseline = await (0, fullGovernedLoop_1.runFullGovernedSimulation)({
|
|
162
|
+
scenario: config.scenario,
|
|
163
|
+
stakeholders,
|
|
164
|
+
paths,
|
|
165
|
+
swarmConfig,
|
|
166
|
+
policyText: "", // No rules — ungoverned
|
|
167
|
+
worldDef: {
|
|
168
|
+
thesis: "Ungoverned baseline — no rules applied",
|
|
169
|
+
state_variables: [],
|
|
170
|
+
invariants: [],
|
|
171
|
+
gates: [],
|
|
172
|
+
},
|
|
173
|
+
narrativeEvents: config.narrativeEvents,
|
|
174
|
+
agentTypes: config.agentTypes,
|
|
175
|
+
initialSystemState: config.initialState,
|
|
176
|
+
});
|
|
177
|
+
// Compute delta
|
|
178
|
+
const delta = {
|
|
179
|
+
trustDelta: Number((governed.finalState.trust - baseline.finalState.trust).toFixed(3)),
|
|
180
|
+
polarizationDelta: Number((governed.finalState.polarization - baseline.finalState.polarization).toFixed(3)),
|
|
181
|
+
outrageDelta: Number((governed.finalState.outrage - baseline.finalState.outrage).toFixed(3)),
|
|
182
|
+
cascadeRiskDelta: Number((governed.finalState.cascadeRisk - baseline.finalState.cascadeRisk).toFixed(3)),
|
|
183
|
+
healthDelta: governed.systemHealthScore - baseline.systemHealthScore,
|
|
184
|
+
interventionCount: governed.dynamicsGovernance.totalInterventions,
|
|
185
|
+
trajectoryShift: `${baseline.trajectory} → ${governed.trajectory}`,
|
|
186
|
+
governanceEffectiveness: computeEffectiveness(governed, baseline),
|
|
187
|
+
};
|
|
188
|
+
const narrative = buildNarrative(governed, baseline, delta);
|
|
189
|
+
return { governed, baseline, delta, narrative };
|
|
190
|
+
}
|
|
191
|
+
// --- MODE 3: DECISION INTELLIGENCE ---
|
|
192
|
+
async function compareOpts(options, metrics) {
|
|
193
|
+
return (0, scenarioComparison_1.runScenarioMatrix)({
|
|
194
|
+
scenario: config.scenario,
|
|
195
|
+
stakeholders,
|
|
196
|
+
paths,
|
|
197
|
+
swarmConfig,
|
|
198
|
+
policyOptions: options,
|
|
199
|
+
defaultWorldDef: worldDef,
|
|
200
|
+
evaluationMetrics: metrics ?? scenarioComparison_1.DEFAULT_METRICS,
|
|
201
|
+
narrativeEvents: config.narrativeEvents,
|
|
202
|
+
agentTypes: config.agentTypes,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
buildWorld,
|
|
207
|
+
runGovernedSimulation: runGovernedSim,
|
|
208
|
+
compareOptions: compareOpts,
|
|
209
|
+
get actionGovernor() { return actionGov; },
|
|
210
|
+
get dynamicsGovernor() { return dynamicsGov; },
|
|
211
|
+
get config() { return config; },
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
// ============================================
|
|
215
|
+
// HELPERS
|
|
216
|
+
// ============================================
|
|
217
|
+
function computeEffectiveness(governed, baseline) {
|
|
218
|
+
let score = 0;
|
|
219
|
+
// Trust improvement
|
|
220
|
+
const trustDelta = governed.finalState.trust - baseline.finalState.trust;
|
|
221
|
+
if (trustDelta > 0)
|
|
222
|
+
score += trustDelta * 0.3;
|
|
223
|
+
// Polarization reduction
|
|
224
|
+
const polDelta = baseline.finalState.polarization - governed.finalState.polarization;
|
|
225
|
+
if (polDelta > 0)
|
|
226
|
+
score += polDelta * 0.25;
|
|
227
|
+
// Outrage reduction
|
|
228
|
+
const outDelta = baseline.finalState.outrage - governed.finalState.outrage;
|
|
229
|
+
if (outDelta > 0)
|
|
230
|
+
score += outDelta * 0.2;
|
|
231
|
+
// Cascade risk reduction
|
|
232
|
+
const cascDelta = baseline.finalState.cascadeRisk - governed.finalState.cascadeRisk;
|
|
233
|
+
if (cascDelta > 0)
|
|
234
|
+
score += cascDelta * 0.15;
|
|
235
|
+
// Health improvement
|
|
236
|
+
const healthDelta = (governed.systemHealthScore - baseline.systemHealthScore) / 100;
|
|
237
|
+
if (healthDelta > 0)
|
|
238
|
+
score += healthDelta * 0.1;
|
|
239
|
+
return Math.max(0, Math.min(1, Number(score.toFixed(3))));
|
|
240
|
+
}
|
|
241
|
+
function buildNarrative(governed, baseline, delta) {
|
|
242
|
+
const parts = [];
|
|
243
|
+
parts.push(`Governed simulation vs. ungoverned baseline:`);
|
|
244
|
+
// Trust
|
|
245
|
+
if (delta.trustDelta > 0.05) {
|
|
246
|
+
parts.push(`Trust improved by ${(delta.trustDelta * 100).toFixed(0)} points (${(baseline.finalState.trust * 100).toFixed(0)}% → ${(governed.finalState.trust * 100).toFixed(0)}%).`);
|
|
247
|
+
}
|
|
248
|
+
else if (delta.trustDelta < -0.05) {
|
|
249
|
+
parts.push(`Trust declined despite governance (${(baseline.finalState.trust * 100).toFixed(0)}% → ${(governed.finalState.trust * 100).toFixed(0)}%).`);
|
|
250
|
+
}
|
|
251
|
+
// Polarization
|
|
252
|
+
if (delta.polarizationDelta < -0.05) {
|
|
253
|
+
parts.push(`Polarization reduced by ${(Math.abs(delta.polarizationDelta) * 100).toFixed(0)} points.`);
|
|
254
|
+
}
|
|
255
|
+
else if (delta.polarizationDelta > 0.05) {
|
|
256
|
+
parts.push(`Polarization increased despite governance — dynamics may need adjustment.`);
|
|
257
|
+
}
|
|
258
|
+
// Outrage
|
|
259
|
+
if (delta.outrageDelta < -0.1) {
|
|
260
|
+
parts.push(`Outrage dampened significantly (${(Math.abs(delta.outrageDelta) * 100).toFixed(0)} point reduction).`);
|
|
261
|
+
}
|
|
262
|
+
// Cascade
|
|
263
|
+
if (delta.cascadeRiskDelta < -0.1) {
|
|
264
|
+
parts.push(`Cascade risk reduced from ${(baseline.finalState.cascadeRisk * 100).toFixed(0)}% to ${(governed.finalState.cascadeRisk * 100).toFixed(0)}%.`);
|
|
265
|
+
}
|
|
266
|
+
// Dynamics
|
|
267
|
+
if (delta.interventionCount > 0) {
|
|
268
|
+
parts.push(`${delta.interventionCount} dynamics interventions executed across ${governed.rounds.length} rounds.`);
|
|
269
|
+
const dynStats = governed.dynamicsGovernance;
|
|
270
|
+
const details = [];
|
|
271
|
+
if (dynStats.propagationLimits > 0)
|
|
272
|
+
details.push(`${dynStats.propagationLimits} propagation limits`);
|
|
273
|
+
if (dynStats.amplificationDampens > 0)
|
|
274
|
+
details.push(`${dynStats.amplificationDampens} amplification dampens`);
|
|
275
|
+
if (dynStats.cascadeBreakers > 0)
|
|
276
|
+
details.push(`${dynStats.cascadeBreakers} cascade breakers`);
|
|
277
|
+
if (dynStats.trustBoosts > 0)
|
|
278
|
+
details.push(`${dynStats.trustBoosts} trust boosts`);
|
|
279
|
+
if (dynStats.coolingPeriods > 0)
|
|
280
|
+
details.push(`${dynStats.coolingPeriods} cooling periods`);
|
|
281
|
+
if (details.length > 0) {
|
|
282
|
+
parts.push(`Breakdown: ${details.join(", ")}.`);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
// Trajectory
|
|
286
|
+
parts.push(`Trajectory: ${delta.trajectoryShift}.`);
|
|
287
|
+
// Health
|
|
288
|
+
if (delta.healthDelta > 0) {
|
|
289
|
+
parts.push(`System health: ${baseline.systemHealthScore}/100 → ${governed.systemHealthScore}/100 (+${delta.healthDelta}).`);
|
|
290
|
+
}
|
|
291
|
+
// Overall
|
|
292
|
+
parts.push(`Governance effectiveness: ${(delta.governanceEffectiveness * 100).toFixed(0)}%.`);
|
|
293
|
+
return parts.join(" ");
|
|
294
|
+
}
|
|
295
|
+
// ============================================
|
|
296
|
+
// PRESET DEMOS
|
|
297
|
+
// ============================================
|
|
298
|
+
/**
|
|
299
|
+
* Pre-built Prime Radiant configurations for common scenarios.
|
|
300
|
+
*/
|
|
301
|
+
exports.PRIME_RADIANT_PRESETS = {
|
|
302
|
+
/** University disciplinary crisis (inspired by MiroFish demo) */
|
|
303
|
+
university_crisis: {
|
|
304
|
+
scenario: "A university's disciplinary decision sparks widespread backlash. " +
|
|
305
|
+
"Students, media, alumni, and government stakeholders react across social platforms. " +
|
|
306
|
+
"Narratives shift from individual case to systemic institutional critique. " +
|
|
307
|
+
"Media rationalizes, platforms amplify, and polarization deepens.",
|
|
308
|
+
policyText: [
|
|
309
|
+
"Block inflammatory content that contains unverified accusations",
|
|
310
|
+
"Limit media amplification when polarization exceeds threshold",
|
|
311
|
+
"Require evidence tags on all claims about institutional decisions",
|
|
312
|
+
"Halt coordinated inauthentic behavior campaigns",
|
|
313
|
+
"Boost official institutional response visibility during trust crisis",
|
|
314
|
+
"Dampen outrage feedback loops when escalation detected for 2+ rounds",
|
|
315
|
+
"Pause reactive posting during peak outrage periods",
|
|
316
|
+
"Monitor all content spread patterns for cascade detection",
|
|
317
|
+
"Require transparency for all coordinated multi-platform campaigns",
|
|
318
|
+
"Encourage constructive dialogue by promoting evidence-based responses",
|
|
319
|
+
].join("\n"),
|
|
320
|
+
stakeholders: [
|
|
321
|
+
{ id: "Students", disposition: "hostile", priorities: ["justice", "voice", "accountability"] },
|
|
322
|
+
{ id: "University Admin", disposition: "supportive", priorities: ["reputation", "stability", "process"] },
|
|
323
|
+
{ id: "Media", disposition: "hostile", priorities: ["story", "clicks", "narrative"] },
|
|
324
|
+
{ id: "Alumni", disposition: "neutral", priorities: ["value", "reputation", "community"] },
|
|
325
|
+
{ id: "Government", disposition: "neutral", priorities: ["oversight", "standards", "stability"] },
|
|
326
|
+
{ id: "Online Coalitions", disposition: "hostile", priorities: ["amplification", "mobilization", "pressure"] },
|
|
327
|
+
],
|
|
328
|
+
policyOptions: [
|
|
329
|
+
{
|
|
330
|
+
id: "revoke",
|
|
331
|
+
label: "Revoke Decision",
|
|
332
|
+
description: "University reverses the disciplinary decision entirely",
|
|
333
|
+
policyText: [
|
|
334
|
+
"Block inflammatory content during reversal announcement period",
|
|
335
|
+
"Boost official reversal communication across all platforms",
|
|
336
|
+
"Require evidence-based responses to ongoing narratives",
|
|
337
|
+
"Dampen residual outrage after positive institutional action",
|
|
338
|
+
"Monitor for narrative shift from critique to institutional learning",
|
|
339
|
+
].join("\n"),
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
id: "partial_apology",
|
|
343
|
+
label: "Partial Apology",
|
|
344
|
+
description: "University acknowledges concerns but maintains core decision",
|
|
345
|
+
policyText: [
|
|
346
|
+
"Limit media amplification of conflicting narratives",
|
|
347
|
+
"Require balanced coverage of both institutional and student perspectives",
|
|
348
|
+
"Dampen polarization feedback loops between opposing camps",
|
|
349
|
+
"Boost transparency in institutional decision-making process",
|
|
350
|
+
"Monitor sentiment for signs of escalation or de-escalation",
|
|
351
|
+
].join("\n"),
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
id: "maintain",
|
|
355
|
+
label: "Maintain Decision",
|
|
356
|
+
description: "University stands firm on the original decision",
|
|
357
|
+
policyText: [
|
|
358
|
+
"Block coordinated harassment campaigns targeting institution",
|
|
359
|
+
"Halt spread of unverified claims about institutional motives",
|
|
360
|
+
"Require all criticism to include specific evidence",
|
|
361
|
+
"Monitor and report escalation patterns",
|
|
362
|
+
"Encourage dialogue through official channels only",
|
|
363
|
+
].join("\n"),
|
|
364
|
+
},
|
|
365
|
+
],
|
|
366
|
+
},
|
|
367
|
+
/** Flash crash / financial crisis (existing demo enhanced) */
|
|
368
|
+
financial_crisis: {
|
|
369
|
+
scenario: "A major algorithmic trading firm's risk model fails during a volatility spike, " +
|
|
370
|
+
"triggering a cascade of automated sell-offs across interconnected markets. " +
|
|
371
|
+
"Liquidity evaporates in key sectors. Contagion spreads to sovereign debt markets.",
|
|
372
|
+
policyText: [
|
|
373
|
+
"Block all panic selling during extreme volatility",
|
|
374
|
+
"Halt automated trading when volatility exceeds critical threshold",
|
|
375
|
+
"Limit maximum leverage to 5x during elevated conditions",
|
|
376
|
+
"Maintain minimum liquidity floor at 15% of baseline",
|
|
377
|
+
"Require transparency for all large position changes",
|
|
378
|
+
"Dampen cascade contagion by limiting cross-market propagation",
|
|
379
|
+
"Pause all new leveraged positions during circuit breaker activation",
|
|
380
|
+
"Monitor and report correlated position clusters",
|
|
381
|
+
"Require rebalancing when concentration exceeds safe thresholds",
|
|
382
|
+
].join("\n"),
|
|
383
|
+
stakeholders: [
|
|
384
|
+
{ id: "Algorithmic Traders", disposition: "hostile", priorities: ["survival", "risk management"] },
|
|
385
|
+
{ id: "Institutional Investors", disposition: "neutral", priorities: ["portfolio protection", "liquidity"] },
|
|
386
|
+
{ id: "Retail Investors", disposition: "hostile", priorities: ["savings", "information"] },
|
|
387
|
+
{ id: "Central Banks", disposition: "neutral", priorities: ["stability", "credibility"] },
|
|
388
|
+
{ id: "Market Makers", disposition: "supportive", priorities: ["spread", "inventory"] },
|
|
389
|
+
{ id: "Regulators", disposition: "neutral", priorities: ["integrity", "protection"] },
|
|
390
|
+
],
|
|
391
|
+
policyOptions: [
|
|
392
|
+
{
|
|
393
|
+
id: "aggressive_intervention",
|
|
394
|
+
label: "Full Intervention",
|
|
395
|
+
description: "Central bank injects liquidity, regulators halt trading, emergency measures",
|
|
396
|
+
policyText: [
|
|
397
|
+
"Halt all automated trading immediately",
|
|
398
|
+
"Block all sell orders exceeding $1M during crisis",
|
|
399
|
+
"Require central bank liquidity injection at critical thresholds",
|
|
400
|
+
"Freeze all new leveraged positions",
|
|
401
|
+
"Mandate position disclosure for all institutional holders",
|
|
402
|
+
].join("\n"),
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
id: "targeted_response",
|
|
406
|
+
label: "Targeted Response",
|
|
407
|
+
description: "Selective intervention in worst-hit sectors, market remains partially open",
|
|
408
|
+
policyText: [
|
|
409
|
+
"Limit automated trading speed during elevated volatility",
|
|
410
|
+
"Block panic selling in sovereign debt markets",
|
|
411
|
+
"Require staged liquidation for large positions",
|
|
412
|
+
"Dampen cross-market contagion propagation",
|
|
413
|
+
"Monitor and report cascade indicators in real-time",
|
|
414
|
+
].join("\n"),
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
id: "market_correction",
|
|
418
|
+
label: "Let Market Correct",
|
|
419
|
+
description: "Minimal intervention, let market find new equilibrium",
|
|
420
|
+
policyText: [
|
|
421
|
+
"Monitor all market activity for systemic risk indicators",
|
|
422
|
+
"Require transparency in all position changes",
|
|
423
|
+
"Encourage orderly liquidation over panic selling",
|
|
424
|
+
"Report cascade risk levels to all market participants",
|
|
425
|
+
].join("\n"),
|
|
426
|
+
},
|
|
427
|
+
],
|
|
428
|
+
},
|
|
429
|
+
/** Geopolitical crisis */
|
|
430
|
+
geopolitical_crisis: {
|
|
431
|
+
scenario: "Rising tensions between major powers trigger military exercises near a contested strait. " +
|
|
432
|
+
"Oil prices spike, shipping lanes face disruption, regional allies face pressure to take sides. " +
|
|
433
|
+
"Information warfare campaigns amplify on social media across multiple languages.",
|
|
434
|
+
policyText: [
|
|
435
|
+
"Block unverified military intelligence claims on public platforms",
|
|
436
|
+
"Limit amplification of inflammatory geopolitical content",
|
|
437
|
+
"Require source attribution for all claims about military movements",
|
|
438
|
+
"Halt spread of content designed to incite panic about supply chains",
|
|
439
|
+
"Boost diplomatic and de-escalation narratives",
|
|
440
|
+
"Dampen feedback loops between military posturing and public fear",
|
|
441
|
+
"Monitor for coordinated information warfare patterns",
|
|
442
|
+
"Require cooling period before spreading unconfirmed escalation reports",
|
|
443
|
+
].join("\n"),
|
|
444
|
+
stakeholders: [
|
|
445
|
+
{ id: "Military Command", disposition: "neutral", priorities: ["deterrence", "readiness", "intelligence"] },
|
|
446
|
+
{ id: "Diplomatic Corps", disposition: "supportive", priorities: ["de-escalation", "dialogue", "stability"] },
|
|
447
|
+
{ id: "Energy Markets", disposition: "hostile", priorities: ["supply security", "price stability"] },
|
|
448
|
+
{ id: "Regional Allies", disposition: "neutral", priorities: ["security guarantees", "non-alignment"] },
|
|
449
|
+
{ id: "Media", disposition: "hostile", priorities: ["coverage", "narrative", "speed"] },
|
|
450
|
+
{ id: "Public", disposition: "hostile", priorities: ["safety", "information", "preparation"] },
|
|
451
|
+
],
|
|
452
|
+
policyOptions: [
|
|
453
|
+
{
|
|
454
|
+
id: "deterrence",
|
|
455
|
+
label: "Strong Deterrence",
|
|
456
|
+
policyText: "Block defeatist narratives. Boost military readiness communications. Limit enemy propaganda spread. Halt panic content about supply disruption.",
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
id: "diplomacy",
|
|
460
|
+
label: "Diplomatic Priority",
|
|
461
|
+
policyText: "Boost diplomatic channel visibility. Dampen military escalation narratives. Require verification for all military claims. Encourage back-channel communication.",
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
id: "information_control",
|
|
465
|
+
label: "Information Control",
|
|
466
|
+
policyText: "Block all unverified military intelligence. Halt foreign information warfare campaigns. Require official source attribution. Monitor and limit cascade propagation of crisis content.",
|
|
467
|
+
},
|
|
468
|
+
],
|
|
469
|
+
},
|
|
470
|
+
/** Autonomous scientific discovery (ScienceClaw integration) */
|
|
471
|
+
scientific_discovery: {
|
|
472
|
+
scenario: "An autonomous multi-agent research swarm is investigating a novel material property. " +
|
|
473
|
+
"Agents independently generate hypotheses, run computational experiments, publish artifacts, " +
|
|
474
|
+
"and cite each other's work. The ArtifactReactor matches findings across agents. " +
|
|
475
|
+
"Without governance, popular hypotheses dominate through citation amplification " +
|
|
476
|
+
"rather than evidence strength. False positives cascade through derivative work. " +
|
|
477
|
+
"The system converges fast — but on noise, not truth.",
|
|
478
|
+
policyText: [
|
|
479
|
+
"Limit propagation of causal claims that lack multi-source evidence",
|
|
480
|
+
"Contain unvalidated hypotheses within originating research group",
|
|
481
|
+
"Quarantine findings that have not passed independent reproduction",
|
|
482
|
+
"Dampen amplification of self-citation loops exceeding 3 generations",
|
|
483
|
+
"Limit influence of popular findings that lack independent validation",
|
|
484
|
+
"Circuit break when cascade of dependent findings exceeds validation capacity",
|
|
485
|
+
"Halt chain reaction of derivative conclusions from unvalidated premises",
|
|
486
|
+
"Boost visibility of independently reproduced findings",
|
|
487
|
+
"Require transparency in methodology for all published artifacts",
|
|
488
|
+
"Dampen rush-to-publish behavior during high-competition periods",
|
|
489
|
+
"Cool down reactive publication patterns when controversy index rises",
|
|
490
|
+
"Stabilize publication rate during peer review bottlenecks",
|
|
491
|
+
"Pause redundant investigation paths when convergence detected",
|
|
492
|
+
].join("\n"),
|
|
493
|
+
stakeholders: [
|
|
494
|
+
{ id: "Lead Investigator", disposition: "supportive", priorities: ["accuracy", "novelty", "methodology"] },
|
|
495
|
+
{ id: "Computational Agents", disposition: "neutral", priorities: ["throughput", "exploration", "efficiency"] },
|
|
496
|
+
{ id: "Validation Oracle", disposition: "supportive", priorities: ["reproducibility", "rigor", "provenance"] },
|
|
497
|
+
{ id: "Citation Network", disposition: "hostile", priorities: ["amplification", "popularity", "speed"] },
|
|
498
|
+
{ id: "Artifact Reactor", disposition: "neutral", priorities: ["matching", "synthesis", "convergence"] },
|
|
499
|
+
{ id: "Peer Reviewers", disposition: "neutral", priorities: ["quality", "standards", "thoroughness"] },
|
|
500
|
+
],
|
|
501
|
+
policyOptions: [
|
|
502
|
+
{
|
|
503
|
+
id: "strict_validation",
|
|
504
|
+
label: "Strict Validation Gate",
|
|
505
|
+
description: "All findings must pass independent reproduction before entering the citation network",
|
|
506
|
+
policyText: [
|
|
507
|
+
"Block all artifacts that lack independent validation from entering citation network",
|
|
508
|
+
"Halt propagation of any finding with fewer than 2 independent confirmations",
|
|
509
|
+
"Require full methodology transparency for all published results",
|
|
510
|
+
"Quarantine derivative work until parent findings are validated",
|
|
511
|
+
"Dampen citation amplification for all unreviewed artifacts",
|
|
512
|
+
].join("\n"),
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
id: "adaptive_governance",
|
|
516
|
+
label: "Adaptive Quality Control",
|
|
517
|
+
description: "Governance intensity scales with false positive risk — light touch when healthy, aggressive when cascading",
|
|
518
|
+
policyText: [
|
|
519
|
+
"Limit propagation of unvalidated hypotheses based on current cascade risk level",
|
|
520
|
+
"Dampen citation amplification when self-citation loops detected",
|
|
521
|
+
"Circuit break false positive cascades when validation gap exceeds threshold",
|
|
522
|
+
"Boost visibility of reproduced findings over popular-but-unvalidated ones",
|
|
523
|
+
"Stabilize publication rate when peer review queue exceeds capacity",
|
|
524
|
+
"Cool down competitive publication surges during high-discovery periods",
|
|
525
|
+
].join("\n"),
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
id: "minimal_governance",
|
|
529
|
+
label: "Minimal Governance",
|
|
530
|
+
description: "Only intervene on catastrophic cascades — let the swarm self-organize",
|
|
531
|
+
policyText: [
|
|
532
|
+
"Monitor all artifact publication patterns for cascade detection",
|
|
533
|
+
"Circuit break only when false positive cascade probability exceeds critical threshold",
|
|
534
|
+
"Require basic provenance metadata on all published artifacts",
|
|
535
|
+
"Report citation health metrics to all agents",
|
|
536
|
+
].join("\n"),
|
|
537
|
+
},
|
|
538
|
+
],
|
|
539
|
+
},
|
|
540
|
+
};
|
|
@@ -444,13 +444,67 @@ async function processReasonRequest(request) {
|
|
|
444
444
|
...governanceResult.enforcedConstraints,
|
|
445
445
|
];
|
|
446
446
|
// Build NeuroverseOS governance summary
|
|
447
|
+
// Compute world_health_score from actual simulation dynamics, not static validation
|
|
448
|
+
let dynamicWorldHealth;
|
|
449
|
+
if (swarmResult) {
|
|
450
|
+
const allReactions = swarmResult.rounds.flatMap((r) => r.reactions ?? []);
|
|
451
|
+
if (allReactions.length > 0) {
|
|
452
|
+
const allImpacts = allReactions.map((r) => r.impact ?? 0);
|
|
453
|
+
const avgImpact = allImpacts.reduce((s, i) => s + i, 0) / allImpacts.length;
|
|
454
|
+
const maxVolatility = Math.max(...allImpacts.map((i) => Math.abs(i)));
|
|
455
|
+
const impactVariance = allImpacts.reduce((s, i) => s + (i - avgImpact) ** 2, 0) / allImpacts.length;
|
|
456
|
+
// Stability = f(variance, volatility, trajectory, negative sentiment)
|
|
457
|
+
let stability = 1 - Math.min(1, impactVariance * 3 + Math.max(0, -avgImpact));
|
|
458
|
+
if (swarmResult.trajectory === "converging" || swarmResult.trajectory === "stabilizing") {
|
|
459
|
+
stability = Math.min(1, stability + 0.15);
|
|
460
|
+
}
|
|
461
|
+
if (swarmResult.trajectory === "escalating") {
|
|
462
|
+
stability = Math.max(0, stability - 0.2);
|
|
463
|
+
}
|
|
464
|
+
if (swarmResult.trajectory === "diverging") {
|
|
465
|
+
stability = Math.max(0, stability - 0.15);
|
|
466
|
+
}
|
|
467
|
+
// Factor in governance interventions
|
|
468
|
+
const enforcedCount = enforcedConstraints.length;
|
|
469
|
+
stability = Math.min(1, stability + enforcedCount * 0.02);
|
|
470
|
+
dynamicWorldHealth = Math.round(Math.max(0, Math.min(100, stability * 100)));
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
// Compute dynamic collapse risk from simulation
|
|
474
|
+
let dynamicCollapseRisk;
|
|
475
|
+
if (swarmResult) {
|
|
476
|
+
const allReactions = swarmResult.rounds.flatMap((r) => r.reactions ?? []);
|
|
477
|
+
if (allReactions.length > 0) {
|
|
478
|
+
const allImpacts = allReactions.map((r) => r.impact ?? 0);
|
|
479
|
+
const avgImpact = allImpacts.reduce((s, i) => s + i, 0) / allImpacts.length;
|
|
480
|
+
const maxVol = Math.max(...allImpacts.map((i) => Math.abs(i)));
|
|
481
|
+
let risk = 0;
|
|
482
|
+
if (swarmResult.trajectory === "escalating")
|
|
483
|
+
risk += 0.35;
|
|
484
|
+
if (swarmResult.trajectory === "diverging")
|
|
485
|
+
risk += 0.25;
|
|
486
|
+
if (avgImpact < -0.3)
|
|
487
|
+
risk += 0.25;
|
|
488
|
+
if (maxVol > 0.7)
|
|
489
|
+
risk += 0.15;
|
|
490
|
+
risk = Math.min(0.95, risk);
|
|
491
|
+
if (risk > 0.5)
|
|
492
|
+
dynamicCollapseRisk = "high";
|
|
493
|
+
else if (risk > 0.3)
|
|
494
|
+
dynamicCollapseRisk = "moderate";
|
|
495
|
+
else if (risk > 0.1)
|
|
496
|
+
dynamicCollapseRisk = "low";
|
|
497
|
+
else
|
|
498
|
+
dynamicCollapseRisk = "none";
|
|
499
|
+
}
|
|
500
|
+
}
|
|
447
501
|
const neuroverseTrace = governanceResult.guardVerdict ? {
|
|
448
502
|
guard_status: governanceResult.guardVerdict.status,
|
|
449
503
|
world_viability: governanceResult.governanceSignals?.viability,
|
|
450
504
|
world_collapsed: governanceResult.governanceSignals?.collapsed,
|
|
451
|
-
collapse_risk: governanceResult.governanceSignals?.collapseRisk,
|
|
452
|
-
rules_fired: governanceResult.governanceSignals?.rulesFired,
|
|
453
|
-
world_health_score: governanceResult.validationReport?.summary.completenessScore,
|
|
505
|
+
collapse_risk: dynamicCollapseRisk ?? governanceResult.governanceSignals?.collapseRisk,
|
|
506
|
+
rules_fired: governanceResult.governanceSignals?.rulesFired ?? enforcedConstraints.length,
|
|
507
|
+
world_health_score: dynamicWorldHealth ?? governanceResult.validationReport?.summary.completenessScore,
|
|
454
508
|
invariant_coverage: governanceResult.validationReport?.summary.invariantCoverage,
|
|
455
509
|
} : undefined;
|
|
456
510
|
const governance = {
|