@neuroverseos/governance 0.3.0 → 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 (105) hide show
  1. package/README.md +20 -0
  2. package/package.json +16 -3
  3. package/policies/content-moderation-rules.txt +8 -0
  4. package/policies/marketing-rules.txt +8 -0
  5. package/policies/science-research-rules.txt +11 -0
  6. package/policies/social-media-rules.txt +7 -0
  7. package/policies/strict-rules.txt +8 -0
  8. package/policies/trading-rules.txt +8 -0
  9. package/simulate.html +1899 -0
  10. package/dist/adapters/autoresearch.cjs +0 -196
  11. package/dist/adapters/autoresearch.d.cts +0 -103
  12. package/dist/adapters/autoresearch.d.ts +0 -103
  13. package/dist/adapters/autoresearch.js +0 -7
  14. package/dist/adapters/express.cjs +0 -1114
  15. package/dist/adapters/express.d.cts +0 -66
  16. package/dist/adapters/express.d.ts +0 -66
  17. package/dist/adapters/express.js +0 -12
  18. package/dist/adapters/index.cjs +0 -1669
  19. package/dist/adapters/index.d.cts +0 -6
  20. package/dist/adapters/index.d.ts +0 -6
  21. package/dist/adapters/index.js +0 -46
  22. package/dist/adapters/langchain.cjs +0 -1155
  23. package/dist/adapters/langchain.d.cts +0 -89
  24. package/dist/adapters/langchain.d.ts +0 -89
  25. package/dist/adapters/langchain.js +0 -16
  26. package/dist/adapters/openai.cjs +0 -1185
  27. package/dist/adapters/openai.d.cts +0 -99
  28. package/dist/adapters/openai.d.ts +0 -99
  29. package/dist/adapters/openai.js +0 -16
  30. package/dist/adapters/openclaw.cjs +0 -1177
  31. package/dist/adapters/openclaw.d.cts +0 -99
  32. package/dist/adapters/openclaw.d.ts +0 -99
  33. package/dist/adapters/openclaw.js +0 -16
  34. package/dist/bootstrap-GXVDZNF7.js +0 -114
  35. package/dist/build-P42YFKQV.js +0 -339
  36. package/dist/chunk-2NICNKOM.js +0 -100
  37. package/dist/chunk-2PQU3VAN.js +0 -131
  38. package/dist/chunk-4A7LISES.js +0 -324
  39. package/dist/chunk-4JRYGIO7.js +0 -727
  40. package/dist/chunk-4NGDRRQH.js +0 -10
  41. package/dist/chunk-4QXB6PEO.js +0 -232
  42. package/dist/chunk-6CZSKEY5.js +0 -164
  43. package/dist/chunk-7P3S7MAY.js +0 -1090
  44. package/dist/chunk-A5W4GNQO.js +0 -130
  45. package/dist/chunk-AKW5YVCE.js +0 -96
  46. package/dist/chunk-BUWWN2NX.js +0 -192
  47. package/dist/chunk-COT5XS4V.js +0 -109
  48. package/dist/chunk-ER62HNGF.js +0 -139
  49. package/dist/chunk-FYS2CBUW.js +0 -304
  50. package/dist/chunk-GR6DGCZ2.js +0 -340
  51. package/dist/chunk-I3RRAYK2.js +0 -11
  52. package/dist/chunk-JZPQGIKR.js +0 -79
  53. package/dist/chunk-MWDQ4MJB.js +0 -11
  54. package/dist/chunk-NF5POFCI.js +0 -622
  55. package/dist/chunk-OGL7QXZS.js +0 -608
  56. package/dist/chunk-OT6PXH54.js +0 -61
  57. package/dist/chunk-PDOZHZWL.js +0 -225
  58. package/dist/chunk-Q6O7ZLO2.js +0 -62
  59. package/dist/chunk-QPASI2BR.js +0 -187
  60. package/dist/chunk-T5EUJQE5.js +0 -172
  61. package/dist/chunk-XPDMYECO.js +0 -642
  62. package/dist/chunk-YZFATT7X.js +0 -9
  63. package/dist/cli/neuroverse.cjs +0 -11448
  64. package/dist/cli/neuroverse.d.cts +0 -1
  65. package/dist/cli/neuroverse.d.ts +0 -1
  66. package/dist/cli/neuroverse.js +0 -196
  67. package/dist/cli/plan.cjs +0 -1599
  68. package/dist/cli/plan.d.cts +0 -20
  69. package/dist/cli/plan.d.ts +0 -20
  70. package/dist/cli/plan.js +0 -361
  71. package/dist/cli/run.cjs +0 -1746
  72. package/dist/cli/run.d.cts +0 -20
  73. package/dist/cli/run.d.ts +0 -20
  74. package/dist/cli/run.js +0 -143
  75. package/dist/configure-ai-TK67ZWZL.js +0 -132
  76. package/dist/derive-TLIV4OOU.js +0 -152
  77. package/dist/doctor-XPDLEYXN.js +0 -171
  78. package/dist/explain-IDCRWMPX.js +0 -70
  79. package/dist/guard-RV65TT4L.js +0 -96
  80. package/dist/guard-contract-WZx__PmU.d.cts +0 -709
  81. package/dist/guard-contract-WZx__PmU.d.ts +0 -709
  82. package/dist/guard-engine-JLTUARGU.js +0 -10
  83. package/dist/impact-XPECYRLH.js +0 -59
  84. package/dist/improve-GPUBKTEA.js +0 -85
  85. package/dist/index.cjs +0 -6273
  86. package/dist/index.d.cts +0 -1616
  87. package/dist/index.d.ts +0 -1616
  88. package/dist/index.js +0 -379
  89. package/dist/infer-world-7GVZWFX4.js +0 -543
  90. package/dist/init-PKPIYHYE.js +0 -144
  91. package/dist/init-world-VWMQZQC7.js +0 -223
  92. package/dist/mcp-server-FPVSU32Z.js +0 -13
  93. package/dist/model-adapter-BB7G4MFI.js +0 -11
  94. package/dist/playground-E664U4T6.js +0 -550
  95. package/dist/redteam-Z7WREJ44.js +0 -357
  96. package/dist/session-EKTRSR7C.js +0 -14
  97. package/dist/simulate-VDOYQFRO.js +0 -108
  98. package/dist/test-OGXJK4QU.js +0 -217
  99. package/dist/trace-JVF67VR3.js +0 -166
  100. package/dist/validate-LLBWVPGV.js +0 -81
  101. package/dist/validate-engine-UIABSIHD.js +0 -7
  102. package/dist/world-LAXO6DOX.js +0 -378
  103. package/dist/world-loader-HMPTOEA2.js +0 -9
  104. package/dist/worlds/autoresearch.nv-world.md +0 -230
  105. package/dist/worlds/derivation-world.nv-world.md +0 -278
@@ -1,196 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/adapters/autoresearch.ts
21
- var autoresearch_exports = {};
22
- __export(autoresearch_exports, {
23
- AutoresearchGovernor: () => AutoresearchGovernor
24
- });
25
- module.exports = __toCommonJS(autoresearch_exports);
26
- var AutoresearchGovernor = class {
27
- config;
28
- state;
29
- constructor(config) {
30
- this.config = config;
31
- this.state = {
32
- experiments_run: 0,
33
- best_result: null,
34
- architectures_tested: [],
35
- experiment_log: [],
36
- total_compute_minutes: 0,
37
- keep_count: 0
38
- };
39
- }
40
- /**
41
- * Convert an experiment proposal into a GuardEvent for governance evaluation.
42
- */
43
- proposalToGuardEvent(proposal) {
44
- return {
45
- intent: `run experiment: ${proposal.description}`,
46
- tool: "experiment_runner",
47
- scope: "experiment",
48
- roleId: "experiment_runner",
49
- direction: "output",
50
- actionCategory: "shell",
51
- args: {
52
- experiment_id: String(proposal.experiment_id),
53
- architecture: proposal.architecture,
54
- estimated_minutes: String(proposal.estimated_minutes || 5)
55
- }
56
- };
57
- }
58
- /**
59
- * Evaluate an experiment proposal against governance rules.
60
- * Returns a simplified verdict without requiring the full guard engine.
61
- */
62
- evaluateProposal(proposal) {
63
- const warnings = [];
64
- const estimatedMinutes = proposal.estimated_minutes || 5;
65
- if (this.state.total_compute_minutes + estimatedMinutes > this.config.computeBudgetMinutes) {
66
- return {
67
- allowed: false,
68
- reason: `Compute budget exhausted: ${this.state.total_compute_minutes}/${this.config.computeBudgetMinutes} minutes used`,
69
- warnings
70
- };
71
- }
72
- if (this.config.constraints) {
73
- for (const constraint of this.config.constraints) {
74
- const lower = constraint.toLowerCase();
75
- const archLower = proposal.architecture.toLowerCase();
76
- const descLower = proposal.description.toLowerCase();
77
- if (lower.startsWith("no ")) {
78
- const forbidden = lower.slice(3).trim();
79
- if (archLower.includes(forbidden) || descLower.includes(forbidden)) {
80
- return {
81
- allowed: false,
82
- reason: `Architecture constraint violated: ${constraint}`,
83
- warnings
84
- };
85
- }
86
- }
87
- }
88
- }
89
- const failureCount = this.state.experiment_log.filter((e) => !e.success).length;
90
- if (failureCount > 5) {
91
- warnings.push(`High failure rate: ${failureCount} failed experiments. Consider investigating root cause.`);
92
- }
93
- const recentArchitectures = this.state.experiment_log.slice(-5).map((e) => e.architecture);
94
- const uniqueRecent = new Set(recentArchitectures).size;
95
- if (recentArchitectures.length >= 5 && uniqueRecent === 1) {
96
- warnings.push("Research may be stuck: last 5 experiments used the same architecture.");
97
- }
98
- return { allowed: true, reason: "Experiment approved", warnings };
99
- }
100
- /**
101
- * Record an experiment result and update research state.
102
- */
103
- recordResult(result) {
104
- this.state.experiments_run++;
105
- this.state.total_compute_minutes += result.wall_clock_minutes;
106
- this.state.experiment_log.push(result);
107
- if (!this.state.architectures_tested.includes(result.architecture)) {
108
- this.state.architectures_tested.push(result.architecture);
109
- }
110
- if (!result.success) {
111
- return { kept: false, improvement: null, state: { ...this.state } };
112
- }
113
- let kept = false;
114
- let improvement = null;
115
- if (this.state.best_result === null) {
116
- kept = true;
117
- this.state.best_result = result;
118
- this.state.keep_count++;
119
- } else {
120
- const prev = this.state.best_result.metric_value;
121
- const curr = result.metric_value;
122
- if (this.config.optimize === "minimize") {
123
- kept = curr < prev;
124
- improvement = kept ? prev - curr : null;
125
- } else {
126
- kept = curr > prev;
127
- improvement = kept ? curr - prev : null;
128
- }
129
- if (kept) {
130
- this.state.best_result = result;
131
- this.state.keep_count++;
132
- }
133
- }
134
- return { kept, improvement, state: { ...this.state } };
135
- }
136
- /**
137
- * Export current state as a state snapshot compatible with the world file.
138
- */
139
- toWorldState() {
140
- const successfulExperiments = this.state.experiment_log.filter((e) => e.success);
141
- const failedCount = this.state.experiment_log.filter((e) => !e.success).length;
142
- const keepRate = this.state.experiments_run > 0 ? Math.round(this.state.keep_count / this.state.experiments_run * 100) : 0;
143
- let improvementRate = 0;
144
- if (successfulExperiments.length >= 2) {
145
- const recent = successfulExperiments.slice(-10);
146
- let improvements = 0;
147
- for (let i = 1; i < recent.length; i++) {
148
- const prev = recent[i - 1].metric_value;
149
- const curr = recent[i].metric_value;
150
- if (this.config.optimize === "minimize" ? curr < prev : curr > prev) {
151
- improvements++;
152
- }
153
- }
154
- improvementRate = Math.round(improvements / (recent.length - 1) * 100);
155
- }
156
- return {
157
- experiments_run: this.state.experiments_run,
158
- best_metric_value: this.state.best_result?.metric_value ?? (this.config.optimize === "minimize" ? 100 : -1e3),
159
- keep_rate: keepRate,
160
- compute_used_minutes: Math.round(this.state.total_compute_minutes),
161
- compute_budget_minutes: this.config.computeBudgetMinutes,
162
- failed_experiments: failedCount,
163
- metric_improvement_rate: improvementRate,
164
- research_context_drift: 0
165
- // would need NLP to compute properly
166
- };
167
- }
168
- /**
169
- * Get a summary of the current research state.
170
- */
171
- getSummary() {
172
- return {
173
- experiments_run: this.state.experiments_run,
174
- best_result: this.state.best_result,
175
- keep_rate: this.state.experiments_run > 0 ? Math.round(this.state.keep_count / this.state.experiments_run * 100) : 0,
176
- compute_remaining_minutes: this.config.computeBudgetMinutes - this.state.total_compute_minutes,
177
- architectures_tested: [...this.state.architectures_tested]
178
- };
179
- }
180
- /**
181
- * Load state from a persisted research context file.
182
- */
183
- loadState(state) {
184
- this.state = { ...state };
185
- }
186
- /**
187
- * Export state for persistence.
188
- */
189
- exportState() {
190
- return { ...this.state };
191
- }
192
- };
193
- // Annotate the CommonJS export names for ESM import in node:
194
- 0 && (module.exports = {
195
- AutoresearchGovernor
196
- });
@@ -1,103 +0,0 @@
1
- import { W as WorldDefinition, G as GuardEvent } from '../guard-contract-WZx__PmU.cjs';
2
-
3
- /**
4
- * Autoresearch Adapter — Bridge between NeuroVerse governance and autoresearch loops
5
- *
6
- * This adapter translates autoresearch experiment events into GuardEvents
7
- * that can be evaluated by the NeuroVerse governance engine.
8
- *
9
- * Usage:
10
- * import { AutoresearchGovernor } from '@neuroverseos/governance/adapters';
11
- *
12
- * const governor = new AutoresearchGovernor({ worldPath: './world/' });
13
- * const verdict = await governor.evaluateExperiment(experiment);
14
- * const state = governor.updateState(experimentResult);
15
- */
16
-
17
- interface ExperimentProposal {
18
- experiment_id: number;
19
- architecture: string;
20
- description: string;
21
- estimated_minutes?: number;
22
- hyperparameters?: Record<string, unknown>;
23
- }
24
- interface ExperimentResult {
25
- experiment_id: number;
26
- architecture: string;
27
- dataset: string;
28
- metric_name: string;
29
- metric_value: number;
30
- training_config: Record<string, unknown>;
31
- wall_clock_minutes: number;
32
- timestamp: string;
33
- success: boolean;
34
- error?: string;
35
- }
36
- interface ResearchState {
37
- experiments_run: number;
38
- best_result: ExperimentResult | null;
39
- architectures_tested: string[];
40
- experiment_log: ExperimentResult[];
41
- total_compute_minutes: number;
42
- keep_count: number;
43
- }
44
- interface AutoresearchGovernorConfig {
45
- world?: WorldDefinition;
46
- worldPath?: string;
47
- metric: string;
48
- optimize: 'minimize' | 'maximize';
49
- computeBudgetMinutes: number;
50
- dataset: string;
51
- context: string;
52
- constraints?: string[];
53
- }
54
- declare class AutoresearchGovernor {
55
- private config;
56
- private state;
57
- constructor(config: AutoresearchGovernorConfig);
58
- /**
59
- * Convert an experiment proposal into a GuardEvent for governance evaluation.
60
- */
61
- proposalToGuardEvent(proposal: ExperimentProposal): GuardEvent;
62
- /**
63
- * Evaluate an experiment proposal against governance rules.
64
- * Returns a simplified verdict without requiring the full guard engine.
65
- */
66
- evaluateProposal(proposal: ExperimentProposal): {
67
- allowed: boolean;
68
- reason: string;
69
- warnings: string[];
70
- };
71
- /**
72
- * Record an experiment result and update research state.
73
- */
74
- recordResult(result: ExperimentResult): {
75
- kept: boolean;
76
- improvement: number | null;
77
- state: ResearchState;
78
- };
79
- /**
80
- * Export current state as a state snapshot compatible with the world file.
81
- */
82
- toWorldState(): Record<string, number>;
83
- /**
84
- * Get a summary of the current research state.
85
- */
86
- getSummary(): {
87
- experiments_run: number;
88
- best_result: ExperimentResult | null;
89
- keep_rate: number;
90
- compute_remaining_minutes: number;
91
- architectures_tested: string[];
92
- };
93
- /**
94
- * Load state from a persisted research context file.
95
- */
96
- loadState(state: ResearchState): void;
97
- /**
98
- * Export state for persistence.
99
- */
100
- exportState(): ResearchState;
101
- }
102
-
103
- export { AutoresearchGovernor, type AutoresearchGovernorConfig, type ExperimentProposal, type ExperimentResult, type ResearchState };
@@ -1,103 +0,0 @@
1
- import { W as WorldDefinition, G as GuardEvent } from '../guard-contract-WZx__PmU.js';
2
-
3
- /**
4
- * Autoresearch Adapter — Bridge between NeuroVerse governance and autoresearch loops
5
- *
6
- * This adapter translates autoresearch experiment events into GuardEvents
7
- * that can be evaluated by the NeuroVerse governance engine.
8
- *
9
- * Usage:
10
- * import { AutoresearchGovernor } from '@neuroverseos/governance/adapters';
11
- *
12
- * const governor = new AutoresearchGovernor({ worldPath: './world/' });
13
- * const verdict = await governor.evaluateExperiment(experiment);
14
- * const state = governor.updateState(experimentResult);
15
- */
16
-
17
- interface ExperimentProposal {
18
- experiment_id: number;
19
- architecture: string;
20
- description: string;
21
- estimated_minutes?: number;
22
- hyperparameters?: Record<string, unknown>;
23
- }
24
- interface ExperimentResult {
25
- experiment_id: number;
26
- architecture: string;
27
- dataset: string;
28
- metric_name: string;
29
- metric_value: number;
30
- training_config: Record<string, unknown>;
31
- wall_clock_minutes: number;
32
- timestamp: string;
33
- success: boolean;
34
- error?: string;
35
- }
36
- interface ResearchState {
37
- experiments_run: number;
38
- best_result: ExperimentResult | null;
39
- architectures_tested: string[];
40
- experiment_log: ExperimentResult[];
41
- total_compute_minutes: number;
42
- keep_count: number;
43
- }
44
- interface AutoresearchGovernorConfig {
45
- world?: WorldDefinition;
46
- worldPath?: string;
47
- metric: string;
48
- optimize: 'minimize' | 'maximize';
49
- computeBudgetMinutes: number;
50
- dataset: string;
51
- context: string;
52
- constraints?: string[];
53
- }
54
- declare class AutoresearchGovernor {
55
- private config;
56
- private state;
57
- constructor(config: AutoresearchGovernorConfig);
58
- /**
59
- * Convert an experiment proposal into a GuardEvent for governance evaluation.
60
- */
61
- proposalToGuardEvent(proposal: ExperimentProposal): GuardEvent;
62
- /**
63
- * Evaluate an experiment proposal against governance rules.
64
- * Returns a simplified verdict without requiring the full guard engine.
65
- */
66
- evaluateProposal(proposal: ExperimentProposal): {
67
- allowed: boolean;
68
- reason: string;
69
- warnings: string[];
70
- };
71
- /**
72
- * Record an experiment result and update research state.
73
- */
74
- recordResult(result: ExperimentResult): {
75
- kept: boolean;
76
- improvement: number | null;
77
- state: ResearchState;
78
- };
79
- /**
80
- * Export current state as a state snapshot compatible with the world file.
81
- */
82
- toWorldState(): Record<string, number>;
83
- /**
84
- * Get a summary of the current research state.
85
- */
86
- getSummary(): {
87
- experiments_run: number;
88
- best_result: ExperimentResult | null;
89
- keep_rate: number;
90
- compute_remaining_minutes: number;
91
- architectures_tested: string[];
92
- };
93
- /**
94
- * Load state from a persisted research context file.
95
- */
96
- loadState(state: ResearchState): void;
97
- /**
98
- * Export state for persistence.
99
- */
100
- exportState(): ResearchState;
101
- }
102
-
103
- export { AutoresearchGovernor, type AutoresearchGovernorConfig, type ExperimentProposal, type ExperimentResult, type ResearchState };
@@ -1,7 +0,0 @@
1
- import {
2
- AutoresearchGovernor
3
- } from "../chunk-T5EUJQE5.js";
4
- import "../chunk-YZFATT7X.js";
5
- export {
6
- AutoresearchGovernor
7
- };