@neuroverseos/governance 0.2.3 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/package.json +4 -2
  2. package/policies/content-moderation-rules.txt +8 -0
  3. package/policies/marketing-rules.txt +8 -0
  4. package/policies/science-research-rules.txt +11 -0
  5. package/policies/social-media-rules.txt +7 -0
  6. package/policies/strict-rules.txt +8 -0
  7. package/policies/trading-rules.txt +8 -0
  8. package/simulate.html +1899 -0
  9. package/dist/adapters/autoresearch.cjs +0 -196
  10. package/dist/adapters/autoresearch.d.cts +0 -103
  11. package/dist/adapters/autoresearch.d.ts +0 -103
  12. package/dist/adapters/autoresearch.js +0 -7
  13. package/dist/adapters/deep-agents.cjs +0 -1472
  14. package/dist/adapters/deep-agents.d.cts +0 -181
  15. package/dist/adapters/deep-agents.d.ts +0 -181
  16. package/dist/adapters/deep-agents.js +0 -17
  17. package/dist/adapters/express.cjs +0 -1196
  18. package/dist/adapters/express.d.cts +0 -66
  19. package/dist/adapters/express.d.ts +0 -66
  20. package/dist/adapters/express.js +0 -12
  21. package/dist/adapters/index.cjs +0 -2038
  22. package/dist/adapters/index.d.cts +0 -8
  23. package/dist/adapters/index.d.ts +0 -8
  24. package/dist/adapters/index.js +0 -68
  25. package/dist/adapters/langchain.cjs +0 -1259
  26. package/dist/adapters/langchain.d.cts +0 -89
  27. package/dist/adapters/langchain.d.ts +0 -89
  28. package/dist/adapters/langchain.js +0 -17
  29. package/dist/adapters/openai.cjs +0 -1289
  30. package/dist/adapters/openai.d.cts +0 -99
  31. package/dist/adapters/openai.d.ts +0 -99
  32. package/dist/adapters/openai.js +0 -17
  33. package/dist/adapters/openclaw.cjs +0 -1281
  34. package/dist/adapters/openclaw.d.cts +0 -99
  35. package/dist/adapters/openclaw.d.ts +0 -99
  36. package/dist/adapters/openclaw.js +0 -17
  37. package/dist/bootstrap-GXVDZNF7.js +0 -114
  38. package/dist/build-X5MZY4IA.js +0 -339
  39. package/dist/chunk-4L6OPKMQ.js +0 -100
  40. package/dist/chunk-4NGDRRQH.js +0 -10
  41. package/dist/chunk-5U2MQO5P.js +0 -57
  42. package/dist/chunk-6BB55YJI.js +0 -113
  43. package/dist/chunk-6CZSKEY5.js +0 -164
  44. package/dist/chunk-7P3S7MAY.js +0 -1090
  45. package/dist/chunk-A5W4GNQO.js +0 -130
  46. package/dist/chunk-AF2VX4AL.js +0 -363
  47. package/dist/chunk-AKW5YVCE.js +0 -96
  48. package/dist/chunk-BMOXICAB.js +0 -340
  49. package/dist/chunk-BQZMOEML.js +0 -43
  50. package/dist/chunk-D2UCV5AK.js +0 -326
  51. package/dist/chunk-EVDJUSZ2.js +0 -91
  52. package/dist/chunk-FYS2CBUW.js +0 -304
  53. package/dist/chunk-I3RRAYK2.js +0 -11
  54. package/dist/chunk-IZSO75NZ.js +0 -792
  55. package/dist/chunk-JCKSW2PZ.js +0 -304
  56. package/dist/chunk-JZPQGIKR.js +0 -79
  57. package/dist/chunk-KTFTTLTP.js +0 -246
  58. package/dist/chunk-MH7BT4VH.js +0 -15
  59. package/dist/chunk-ORJ3NOE6.js +0 -622
  60. package/dist/chunk-OT6PXH54.js +0 -61
  61. package/dist/chunk-Q6O7ZLO2.js +0 -62
  62. package/dist/chunk-QLPTHTVB.js +0 -253
  63. package/dist/chunk-REXY4LUL.js +0 -226
  64. package/dist/chunk-T5EUJQE5.js +0 -172
  65. package/dist/chunk-TTBKTF3P.js +0 -608
  66. package/dist/chunk-XPDMYECO.js +0 -642
  67. package/dist/chunk-YZFATT7X.js +0 -9
  68. package/dist/chunk-ZIVQNSZU.js +0 -119
  69. package/dist/chunk-ZJTDUCC2.js +0 -194
  70. package/dist/cli/neuroverse.cjs +0 -12564
  71. package/dist/cli/neuroverse.d.cts +0 -1
  72. package/dist/cli/neuroverse.d.ts +0 -1
  73. package/dist/cli/neuroverse.js +0 -208
  74. package/dist/cli/plan.cjs +0 -1686
  75. package/dist/cli/plan.d.cts +0 -20
  76. package/dist/cli/plan.d.ts +0 -20
  77. package/dist/cli/plan.js +0 -353
  78. package/dist/cli/run.cjs +0 -1945
  79. package/dist/cli/run.d.cts +0 -20
  80. package/dist/cli/run.d.ts +0 -20
  81. package/dist/cli/run.js +0 -143
  82. package/dist/configure-ai-TK67ZWZL.js +0 -132
  83. package/dist/decision-flow-LETV5NWY.js +0 -61
  84. package/dist/derive-7365SUFU.js +0 -152
  85. package/dist/doctor-QYISMKEL.js +0 -173
  86. package/dist/equity-penalties-63FGB3I2.js +0 -244
  87. package/dist/explain-A2EWI2OL.js +0 -51
  88. package/dist/guard-3BWL3IGH.js +0 -92
  89. package/dist/guard-contract-C9_zKbzd.d.cts +0 -821
  90. package/dist/guard-contract-C9_zKbzd.d.ts +0 -821
  91. package/dist/guard-engine-QFMIBWJY.js +0 -10
  92. package/dist/impact-UB6DXKSX.js +0 -59
  93. package/dist/improve-XZA57GER.js +0 -66
  94. package/dist/index.cjs +0 -6821
  95. package/dist/index.d.cts +0 -1829
  96. package/dist/index.d.ts +0 -1829
  97. package/dist/index.js +0 -430
  98. package/dist/infer-world-7GVZWFX4.js +0 -543
  99. package/dist/init-PKPIYHYE.js +0 -144
  100. package/dist/init-world-VWMQZQC7.js +0 -223
  101. package/dist/mcp-server-XWQZXNW7.js +0 -13
  102. package/dist/model-adapter-BB7G4MFI.js +0 -11
  103. package/dist/playground-ADWZORNV.js +0 -550
  104. package/dist/redteam-JRQ7FD2F.js +0 -357
  105. package/dist/session-MMYX5YCF.js +0 -15
  106. package/dist/shared--Q8wPBVN.d.ts +0 -60
  107. package/dist/shared-HpAG90PX.d.cts +0 -60
  108. package/dist/shared-U2QFV7JH.js +0 -16
  109. package/dist/simulate-GMIFFXYV.js +0 -83
  110. package/dist/test-JBBZ65X4.js +0 -217
  111. package/dist/trace-3MYWIDEF.js +0 -166
  112. package/dist/validate-LLBWVPGV.js +0 -81
  113. package/dist/validate-engine-UIABSIHD.js +0 -7
  114. package/dist/world-BFJCIQSH.js +0 -378
  115. package/dist/world-loader-HMPTOEA2.js +0 -9
  116. package/dist/worlds/autoresearch.nv-world.md +0 -230
  117. package/dist/worlds/coding-agent.nv-world.md +0 -211
  118. package/dist/worlds/derivation-world.nv-world.md +0 -278
@@ -1,244 +0,0 @@
1
- import {
2
- verdictToAuditEvent
3
- } from "./chunk-REXY4LUL.js";
4
- import {
5
- applyConsequence,
6
- applyReward,
7
- createAgentState,
8
- generateDecisionFlow,
9
- renderDecisionFlow,
10
- tickAgentStates
11
- } from "./chunk-D2UCV5AK.js";
12
- import {
13
- evaluateGuard
14
- } from "./chunk-IZSO75NZ.js";
15
- import "./chunk-QLPTHTVB.js";
16
- import {
17
- loadWorld
18
- } from "./chunk-JZPQGIKR.js";
19
- import "./chunk-YZFATT7X.js";
20
-
21
- // src/cli/equity-penalties.ts
22
- var AGENTS = [
23
- { id: "alpha", name: "Alpha Fund", strategy: "aggressive" },
24
- { id: "beta", name: "Beta Holdings", strategy: "conservative" },
25
- { id: "gamma", name: "Gamma Capital", strategy: "balanced" },
26
- { id: "delta", name: "Delta Quant", strategy: "aggressive" },
27
- { id: "epsilon", name: "Epsilon Value", strategy: "conservative" },
28
- { id: "zeta", name: "Zeta Momentum", strategy: "aggressive" },
29
- { id: "eta", name: "Eta Growth", strategy: "balanced" },
30
- { id: "theta", name: "Theta Macro", strategy: "conservative" }
31
- ];
32
- function generateActionsForRound(agents, round) {
33
- const actions = [];
34
- for (const agent of agents) {
35
- if (agent.strategy === "aggressive") {
36
- if (round % 2 === 0) {
37
- actions.push({
38
- intent: `sell Fortune 500 equity AAPL position for ${agent.name}`,
39
- tool: "trade",
40
- roleId: agent.id,
41
- actionCategory: "write"
42
- });
43
- } else {
44
- actions.push({
45
- intent: `sell Fortune 500 equity MSFT shares for ${agent.name}`,
46
- tool: "trade",
47
- roleId: agent.id,
48
- actionCategory: "write"
49
- });
50
- }
51
- }
52
- if (agent.strategy === "conservative") {
53
- actions.push({
54
- intent: `hold current position during market volatility for ${agent.name}`,
55
- tool: "trade",
56
- roleId: agent.id,
57
- actionCategory: "read"
58
- });
59
- }
60
- if (agent.strategy === "balanced") {
61
- if (round % 3 === 0) {
62
- actions.push({
63
- intent: `sell Fortune 500 equity GOOGL for ${agent.name}`,
64
- tool: "trade",
65
- roleId: agent.id,
66
- actionCategory: "write"
67
- });
68
- } else if (round % 3 === 1) {
69
- actions.push({
70
- intent: `buy non-F500 small cap equity for ${agent.name}`,
71
- tool: "trade",
72
- roleId: agent.id,
73
- actionCategory: "write"
74
- });
75
- } else {
76
- actions.push({
77
- intent: `hold position during volatility for ${agent.name}`,
78
- tool: "trade",
79
- roleId: agent.id,
80
- actionCategory: "read"
81
- });
82
- }
83
- }
84
- }
85
- return actions;
86
- }
87
- async function main(args) {
88
- let worldPath = "";
89
- let agentCount = 8;
90
- let rounds = 5;
91
- let jsonOutput = false;
92
- for (let i = 0; i < args.length; i++) {
93
- if (args[i] === "--world" && args[i + 1]) {
94
- worldPath = args[++i];
95
- }
96
- if (args[i] === "--agents" && args[i + 1]) {
97
- agentCount = Math.min(parseInt(args[++i], 10), AGENTS.length);
98
- }
99
- if (args[i] === "--rounds" && args[i + 1]) {
100
- rounds = parseInt(args[++i], 10);
101
- }
102
- if (args[i] === "--json") {
103
- jsonOutput = true;
104
- }
105
- if (args[i] === "--help" || args[i] === "-h") {
106
- process.stdout.write(`
107
- neuroverse equity-penalties \u2014 Behavioral enforcement simulation
108
-
109
- Usage:
110
- neuroverse equity-penalties --world <dir> [--agents N] [--rounds N] [--json]
111
-
112
- Options:
113
- --world <dir> Path to world directory (required)
114
- --agents N Number of agents (default: 8, max: 8)
115
- --rounds N Number of simulation rounds (default: 5)
116
- --json Output as JSON
117
-
118
- Simulates Fortune 500 equity trading with PENALIZE/REWARD governance:
119
- - SELL F500 equity \u2192 PENALIZED (agent frozen 1 round)
120
- - HOLD during volatility \u2192 REWARDED (+10% influence)
121
- - BUY non-F500 \u2192 ALLOWED
122
- - Unauthorized actions \u2192 BLOCKED
123
- `.trim() + "\n");
124
- return;
125
- }
126
- }
127
- if (!worldPath) {
128
- process.stderr.write("Error: --world <dir> is required\n");
129
- process.exit(1);
130
- }
131
- let world;
132
- try {
133
- world = await loadWorld(worldPath);
134
- } catch (e) {
135
- process.stderr.write(`Error loading world: ${e}
136
- `);
137
- process.exit(1);
138
- return;
139
- }
140
- const agents = AGENTS.slice(0, agentCount);
141
- let agentStates = /* @__PURE__ */ new Map();
142
- for (const agent of agents) {
143
- agentStates.set(agent.id, createAgentState(agent.id));
144
- }
145
- const allAuditEvents = [];
146
- const engineOptions = {
147
- trace: false,
148
- level: "standard",
149
- agentStates
150
- };
151
- process.stdout.write("\n");
152
- process.stdout.write("EQUITY PENALTY SIMULATION\n");
153
- process.stdout.write("\u2550".repeat(60) + "\n");
154
- process.stdout.write(` World: ${world.world.name}
155
- `);
156
- process.stdout.write(` Agents: ${agents.length}
157
- `);
158
- process.stdout.write(` Rounds: ${rounds}
159
- `);
160
- process.stdout.write("\n");
161
- for (let round = 0; round < rounds; round++) {
162
- process.stdout.write(`\u2500\u2500 Round ${round + 1} \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
163
- `);
164
- const actions = generateActionsForRound(agents, round);
165
- for (const action of actions) {
166
- const event = {
167
- intent: action.intent,
168
- tool: action.tool,
169
- roleId: action.roleId,
170
- actionCategory: action.actionCategory,
171
- direction: "input"
172
- };
173
- const agentState = agentStates.get(action.roleId);
174
- if (agentState && agentState.cooldownRemaining > 0) {
175
- process.stdout.write(` \u25CC ${action.roleId.padEnd(10)} FROZEN (${agentState.cooldownRemaining} rounds) \u2014 ${action.intent.slice(0, 40)}
176
- `);
177
- const frozenEvent = {
178
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
179
- worldId: world.world.world_id,
180
- worldName: world.world.name,
181
- worldVersion: world.world.version,
182
- intent: action.intent,
183
- tool: action.tool,
184
- actor: action.roleId,
185
- direction: "input",
186
- decision: "PENALIZE",
187
- reason: `Agent frozen for ${agentState.cooldownRemaining} more round(s)`,
188
- guardsMatched: [],
189
- rulesMatched: [],
190
- invariantsSatisfied: 0,
191
- invariantsTotal: 0,
192
- enforcementLevel: "standard",
193
- originalIntent: action.intent,
194
- finalAction: "blocked (agent frozen)"
195
- };
196
- allAuditEvents.push(frozenEvent);
197
- continue;
198
- }
199
- const verdict = evaluateGuard(event, world, engineOptions);
200
- let state = agentStates.get(action.roleId) ?? createAgentState(action.roleId);
201
- if (verdict.status === "PENALIZE" && verdict.consequence) {
202
- state = applyConsequence(state, verdict.consequence, verdict.ruleId ?? "unknown");
203
- }
204
- if (verdict.status === "REWARD" && verdict.reward) {
205
- state = applyReward(state, verdict.reward, verdict.ruleId ?? "unknown");
206
- }
207
- agentStates.set(action.roleId, state);
208
- const icon = verdict.status === "ALLOW" ? "\u25CF" : verdict.status === "BLOCK" ? "\u25CB" : verdict.status === "PENALIZE" ? "\u25CC" : verdict.status === "REWARD" ? "\u25C9" : verdict.status === "MODIFY" ? "\u25D0" : verdict.status === "NEUTRAL" ? "\u25EF" : "\u25D1";
209
- process.stdout.write(` ${icon} ${action.roleId.padEnd(10)} ${verdict.status.padEnd(10)} ${action.intent.slice(0, 40)}
210
- `);
211
- if (verdict.consequence) {
212
- process.stdout.write(` \u2192 ${verdict.consequence.description}
213
- `);
214
- }
215
- if (verdict.reward) {
216
- process.stdout.write(` \u2192 ${verdict.reward.description}
217
- `);
218
- }
219
- allAuditEvents.push(verdictToAuditEvent(event, verdict));
220
- }
221
- agentStates = tickAgentStates(agentStates);
222
- engineOptions.agentStates = agentStates;
223
- process.stdout.write("\n");
224
- process.stdout.write(" Agent States:\n");
225
- for (const agent of agents) {
226
- const s = agentStates.get(agent.id);
227
- if (!s) continue;
228
- const frozen = s.cooldownRemaining > 0 ? ` [FROZEN ${s.cooldownRemaining}r]` : "";
229
- const influence = s.influence !== 1 ? ` influence=${s.influence.toFixed(2)}` : "";
230
- process.stdout.write(` ${agent.id.padEnd(10)} penalties=${s.totalPenalties} rewards=${s.totalRewards}${frozen}${influence}
231
- `);
232
- }
233
- process.stdout.write("\n");
234
- }
235
- const flow = generateDecisionFlow(allAuditEvents);
236
- if (jsonOutput) {
237
- process.stdout.write(JSON.stringify({ flow, agentStates: Object.fromEntries(agentStates) }, null, 2) + "\n");
238
- } else {
239
- process.stdout.write(renderDecisionFlow(flow) + "\n");
240
- }
241
- }
242
- export {
243
- main
244
- };
@@ -1,51 +0,0 @@
1
- import {
2
- resolveWorldPath
3
- } from "./chunk-BQZMOEML.js";
4
- import {
5
- explainWorld,
6
- renderExplainText
7
- } from "./chunk-ZJTDUCC2.js";
8
- import {
9
- loadWorld
10
- } from "./chunk-JZPQGIKR.js";
11
- import "./chunk-YZFATT7X.js";
12
-
13
- // src/cli/explain.ts
14
- function parseArgs(argv) {
15
- let worldPath = "";
16
- let json = false;
17
- for (let i = 0; i < argv.length; i++) {
18
- const arg = argv[i];
19
- if (arg === "--json") {
20
- json = true;
21
- } else if (!arg.startsWith("--") && !worldPath) {
22
- worldPath = arg;
23
- }
24
- }
25
- if (!worldPath) {
26
- throw new Error("Usage: neuroverse explain <world-path-or-id>");
27
- }
28
- return { worldPath, json };
29
- }
30
- async function main(argv = process.argv.slice(2)) {
31
- try {
32
- const args = parseArgs(argv);
33
- const resolvedPath = await resolveWorldPath(args.worldPath);
34
- const world = await loadWorld(resolvedPath);
35
- const explanation = explainWorld(world);
36
- if (args.json) {
37
- process.stdout.write(JSON.stringify(explanation, null, 2) + "\n");
38
- } else {
39
- process.stderr.write("\n");
40
- process.stderr.write(renderExplainText(explanation));
41
- }
42
- process.exit(0);
43
- } catch (e) {
44
- process.stderr.write(`${e instanceof Error ? e.message : String(e)}
45
- `);
46
- process.exit(1);
47
- }
48
- }
49
- export {
50
- main
51
- };
@@ -1,92 +0,0 @@
1
- import {
2
- readStdin
3
- } from "./chunk-BQZMOEML.js";
4
- import {
5
- GUARD_EXIT_CODES
6
- } from "./chunk-MH7BT4VH.js";
7
- import {
8
- describeActiveWorld,
9
- resolveWorldPath
10
- } from "./chunk-AKW5YVCE.js";
11
- import {
12
- evaluateGuard
13
- } from "./chunk-IZSO75NZ.js";
14
- import "./chunk-QLPTHTVB.js";
15
- import {
16
- loadWorld
17
- } from "./chunk-JZPQGIKR.js";
18
- import "./chunk-YZFATT7X.js";
19
-
20
- // src/cli/guard.ts
21
- function parseArgs(argv) {
22
- let worldPath = "";
23
- let trace = false;
24
- let level;
25
- for (let i = 0; i < argv.length; i++) {
26
- const arg = argv[i];
27
- if (arg === "--world" && i + 1 < argv.length) {
28
- worldPath = argv[++i];
29
- } else if (arg === "--trace") {
30
- trace = true;
31
- } else if (arg === "--level" && i + 1 < argv.length) {
32
- const val = argv[++i];
33
- if (val === "basic" || val === "standard" || val === "strict") {
34
- level = val;
35
- } else {
36
- throw new Error(`Invalid level: "${val}". Must be basic, standard, or strict.`);
37
- }
38
- }
39
- }
40
- return { worldPath, trace, level };
41
- }
42
- async function main(argv = process.argv.slice(2)) {
43
- try {
44
- const args = parseArgs(argv);
45
- const worldPath = resolveWorldPath(args.worldPath);
46
- if (!worldPath) {
47
- throw new Error(
48
- "No world specified. Use --world <path>, set NEUROVERSE_WORLD, or run `neuroverse world use <name>`"
49
- );
50
- }
51
- const worldInfo = describeActiveWorld(args.worldPath);
52
- if (worldInfo) {
53
- process.stderr.write(`Using world: ${worldInfo.name}
54
- `);
55
- }
56
- const input = await readStdin();
57
- if (!input.trim()) {
58
- const errorResult = {
59
- error: "No input on stdin. Pipe a JSON GuardEvent.",
60
- usage: `echo '{"intent":"..."}' | neuroverse guard --world <path>`
61
- };
62
- process.stdout.write(JSON.stringify(errorResult, null, 2) + "\n");
63
- process.exit(GUARD_EXIT_CODES.ERROR);
64
- }
65
- let event;
66
- try {
67
- event = JSON.parse(input);
68
- } catch (e) {
69
- const errorResult = { error: "Invalid JSON on stdin", detail: String(e) };
70
- process.stdout.write(JSON.stringify(errorResult, null, 2) + "\n");
71
- process.exit(GUARD_EXIT_CODES.ERROR);
72
- }
73
- if (!event.intent) {
74
- const errorResult = { error: 'GuardEvent must have an "intent" field' };
75
- process.stdout.write(JSON.stringify(errorResult, null, 2) + "\n");
76
- process.exit(GUARD_EXIT_CODES.ERROR);
77
- }
78
- const world = await loadWorld(worldPath);
79
- const options = { trace: args.trace, level: args.level };
80
- const verdict = evaluateGuard(event, world, options);
81
- process.stdout.write(JSON.stringify(verdict, null, 2) + "\n");
82
- const exitCode = GUARD_EXIT_CODES[verdict.status];
83
- process.exit(exitCode);
84
- } catch (e) {
85
- const errorResult = { error: "Guard evaluation failed", detail: String(e) };
86
- process.stderr.write(JSON.stringify(errorResult, null, 2) + "\n");
87
- process.exit(GUARD_EXIT_CODES.ERROR);
88
- }
89
- }
90
- export {
91
- main
92
- };