@neuroverseos/governance 0.3.1 → 0.3.3
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/.well-known/ai-plugin.json +34 -9
- package/AGENTS.md +72 -24
- package/README.md +343 -248
- package/dist/adapters/autoresearch.cjs +1345 -0
- package/dist/adapters/autoresearch.d.cts +111 -0
- package/dist/adapters/autoresearch.d.ts +111 -0
- package/dist/adapters/autoresearch.js +12 -0
- package/dist/adapters/deep-agents.cjs +1528 -0
- package/dist/adapters/deep-agents.d.cts +181 -0
- package/dist/adapters/deep-agents.d.ts +181 -0
- package/dist/adapters/deep-agents.js +17 -0
- package/dist/adapters/express.cjs +1253 -0
- package/dist/adapters/express.d.cts +66 -0
- package/dist/adapters/express.d.ts +66 -0
- package/dist/adapters/express.js +12 -0
- package/dist/adapters/index.cjs +2112 -0
- package/dist/adapters/index.d.cts +8 -0
- package/dist/adapters/index.d.ts +8 -0
- package/dist/adapters/index.js +68 -0
- package/dist/adapters/langchain.cjs +1315 -0
- package/dist/adapters/langchain.d.cts +89 -0
- package/dist/adapters/langchain.d.ts +89 -0
- package/dist/adapters/langchain.js +17 -0
- package/dist/adapters/openai.cjs +1345 -0
- package/dist/adapters/openai.d.cts +99 -0
- package/dist/adapters/openai.d.ts +99 -0
- package/dist/adapters/openai.js +17 -0
- package/dist/adapters/openclaw.cjs +1337 -0
- package/dist/adapters/openclaw.d.cts +99 -0
- package/dist/adapters/openclaw.d.ts +99 -0
- package/dist/adapters/openclaw.js +17 -0
- package/dist/add-ROOZLU62.js +314 -0
- package/dist/behavioral-MJO34S6Q.js +118 -0
- package/dist/bootstrap-CQRZVOXK.js +116 -0
- package/dist/bootstrap-emitter-Q7UIJZ2O.js +7 -0
- package/dist/bootstrap-parser-EEF36XDU.js +7 -0
- package/dist/browser.global.js +941 -0
- package/dist/build-QKOBBC23.js +341 -0
- package/dist/chunk-3WQLXYTP.js +91 -0
- package/dist/chunk-4FLICVVA.js +119 -0
- package/dist/chunk-4NGDRRQH.js +10 -0
- package/dist/chunk-5TPFNWRU.js +215 -0
- package/dist/chunk-5U2MQO5P.js +57 -0
- package/dist/chunk-6CZSKEY5.js +164 -0
- package/dist/chunk-6S5CFQXY.js +624 -0
- package/dist/chunk-7P3S7MAY.js +1090 -0
- package/dist/chunk-A5W4GNQO.js +130 -0
- package/dist/chunk-A7GKPPU7.js +226 -0
- package/dist/chunk-AKW5YVCE.js +96 -0
- package/dist/chunk-B6OXJLJ5.js +622 -0
- package/dist/chunk-BNKJPUPQ.js +113 -0
- package/dist/chunk-BQZMOEML.js +43 -0
- package/dist/chunk-CNSO6XW5.js +207 -0
- package/dist/chunk-CTZHONLA.js +135 -0
- package/dist/chunk-D2UCV5AK.js +326 -0
- package/dist/chunk-EMQDLDAF.js +458 -0
- package/dist/chunk-F66BVUYB.js +340 -0
- package/dist/chunk-G7DJ6VOD.js +101 -0
- package/dist/chunk-I3RRAYK2.js +11 -0
- package/dist/chunk-IS4WUH6Y.js +363 -0
- package/dist/chunk-MH7BT4VH.js +15 -0
- package/dist/chunk-O5ABKEA7.js +304 -0
- package/dist/chunk-OT6PXH54.js +61 -0
- package/dist/chunk-PVTQQS3Y.js +186 -0
- package/dist/chunk-Q6O7ZLO2.js +62 -0
- package/dist/chunk-QLPTHTVB.js +253 -0
- package/dist/chunk-QWGCMQQD.js +16 -0
- package/dist/chunk-QXBFT7NI.js +201 -0
- package/dist/chunk-TG6SEF24.js +246 -0
- package/dist/chunk-U6U7EJZL.js +177 -0
- package/dist/chunk-W7LLXRGY.js +830 -0
- package/dist/chunk-ZJTDUCC2.js +194 -0
- package/dist/chunk-ZWI3NIXK.js +314 -0
- package/dist/cli/neuroverse.cjs +14191 -0
- package/dist/cli/neuroverse.d.cts +1 -0
- package/dist/cli/neuroverse.d.ts +1 -0
- package/dist/cli/neuroverse.js +227 -0
- package/dist/cli/plan.cjs +2439 -0
- package/dist/cli/plan.d.cts +20 -0
- package/dist/cli/plan.d.ts +20 -0
- package/dist/cli/plan.js +353 -0
- package/dist/cli/run.cjs +2001 -0
- package/dist/cli/run.d.cts +20 -0
- package/dist/cli/run.d.ts +20 -0
- package/dist/cli/run.js +143 -0
- package/dist/configure-ai-6TZ3MCSI.js +132 -0
- package/dist/decision-flow-M63D47LO.js +61 -0
- package/dist/demo-G43RLCPK.js +469 -0
- package/dist/derive-FJZVIPUZ.js +153 -0
- package/dist/doctor-6BC6X2VO.js +173 -0
- package/dist/equity-penalties-SG5IZQ7I.js +244 -0
- package/dist/explain-RHBU2GBR.js +51 -0
- package/dist/guard-AJCCGZMF.js +92 -0
- package/dist/guard-contract-DqFcTScd.d.cts +821 -0
- package/dist/guard-contract-DqFcTScd.d.ts +821 -0
- package/dist/guard-engine-PNR6MHCM.js +10 -0
- package/dist/impact-3XVDSCBU.js +59 -0
- package/dist/improve-TQP4ECSY.js +66 -0
- package/dist/index.cjs +7591 -0
- package/dist/index.d.cts +2195 -0
- package/dist/index.d.ts +2195 -0
- package/dist/index.js +472 -0
- package/dist/infer-world-IFXCACJ5.js +543 -0
- package/dist/init-FYPV4SST.js +144 -0
- package/dist/init-world-TI7ARHBT.js +223 -0
- package/dist/mcp-server-5Y3ZM7TV.js +13 -0
- package/dist/model-adapter-VXEKB4LS.js +11 -0
- package/dist/playground-VZBNPPBO.js +560 -0
- package/dist/redteam-MZPZD3EF.js +357 -0
- package/dist/session-JYOARW54.js +15 -0
- package/dist/shared-7RLUHNMU.js +16 -0
- package/dist/shared-B8dvUUD8.d.cts +60 -0
- package/dist/shared-Dr5Wiay8.d.ts +60 -0
- package/dist/simulate-LJXYBC6M.js +83 -0
- package/dist/test-BOOR4A5F.js +217 -0
- package/dist/trace-PKV4KX56.js +166 -0
- package/dist/validate-RALX7CZS.js +81 -0
- package/dist/validate-engine-7ZXFVGF2.js +7 -0
- package/dist/viz/assets/index-B8SaeJZZ.js +23 -0
- package/dist/viz/index.html +23 -0
- package/dist/world-BIP4GZBZ.js +376 -0
- package/dist/world-loader-Y6HMQH2D.js +13 -0
- package/dist/worlds/autoresearch.nv-world.md +230 -0
- package/dist/worlds/coding-agent.nv-world.md +211 -0
- package/dist/worlds/derivation-world.nv-world.md +278 -0
- package/dist/worlds/research-agent.nv-world.md +169 -0
- package/dist/worlds/social-media.nv-world.md +198 -0
- package/dist/worlds/trading-agent.nv-world.md +218 -0
- package/examples/social-media-sim/bridge.py +209 -0
- package/examples/social-media-sim/simulation.py +927 -0
- package/package.json +16 -3
- package/simulate.html +4 -336
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import {
|
|
2
|
+
validateWorld
|
|
3
|
+
} from "./chunk-7P3S7MAY.js";
|
|
4
|
+
import {
|
|
5
|
+
describeActiveWorld,
|
|
6
|
+
getActiveWorldName,
|
|
7
|
+
listWorlds,
|
|
8
|
+
resolveWorldPath,
|
|
9
|
+
setActiveWorld
|
|
10
|
+
} from "./chunk-AKW5YVCE.js";
|
|
11
|
+
import {
|
|
12
|
+
loadWorld
|
|
13
|
+
} from "./chunk-CTZHONLA.js";
|
|
14
|
+
import "./chunk-QWGCMQQD.js";
|
|
15
|
+
|
|
16
|
+
// src/cli/world.ts
|
|
17
|
+
var USAGE = `
|
|
18
|
+
neuroverse world \u2014 World management
|
|
19
|
+
|
|
20
|
+
Usage:
|
|
21
|
+
neuroverse world list List available worlds
|
|
22
|
+
neuroverse world use <name> Set the active world
|
|
23
|
+
neuroverse world current Show which world is active and why
|
|
24
|
+
neuroverse world status [path|name] Show world identity and health
|
|
25
|
+
neuroverse world diff <path1> <path2> Compare two world versions
|
|
26
|
+
neuroverse world snapshot <path> Save a timestamped snapshot
|
|
27
|
+
neuroverse world rollback <path> Restore the previous snapshot
|
|
28
|
+
|
|
29
|
+
Environment:
|
|
30
|
+
NEUROVERSE_WORLD=<name> Override active world (for CI/agents)
|
|
31
|
+
|
|
32
|
+
Options:
|
|
33
|
+
--json Output as JSON
|
|
34
|
+
`.trim();
|
|
35
|
+
function parseArgs(argv) {
|
|
36
|
+
const subcommand = argv[0];
|
|
37
|
+
const paths = [];
|
|
38
|
+
const flags = {};
|
|
39
|
+
for (let i = 1; i < argv.length; i++) {
|
|
40
|
+
const arg = argv[i];
|
|
41
|
+
if (arg === "--json") flags.json = true;
|
|
42
|
+
else if (arg === "--help" || arg === "-h") flags.help = true;
|
|
43
|
+
else paths.push(arg);
|
|
44
|
+
}
|
|
45
|
+
return { subcommand, paths, flags };
|
|
46
|
+
}
|
|
47
|
+
async function worldStatus(worldPath, json) {
|
|
48
|
+
const world = await loadWorld(worldPath);
|
|
49
|
+
const report = validateWorld(world);
|
|
50
|
+
if (json) {
|
|
51
|
+
process.stdout.write(JSON.stringify({
|
|
52
|
+
world: world.world,
|
|
53
|
+
metadata: world.metadata,
|
|
54
|
+
guards: world.guards?.guards.length ?? 0,
|
|
55
|
+
invariants: world.invariants.length,
|
|
56
|
+
rules: world.rules.length,
|
|
57
|
+
roles: world.roles?.roles.length ?? 0,
|
|
58
|
+
kernel: world.kernel ? {
|
|
59
|
+
forbiddenInputs: world.kernel.input_boundaries?.forbidden_patterns?.length ?? 0,
|
|
60
|
+
forbiddenOutputs: world.kernel.output_boundaries?.forbidden_patterns?.length ?? 0
|
|
61
|
+
} : null,
|
|
62
|
+
validation: report.summary
|
|
63
|
+
}, null, 2) + "\n");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const lines = [];
|
|
67
|
+
lines.push("WORLD STATUS");
|
|
68
|
+
lines.push("\u2500".repeat(40));
|
|
69
|
+
lines.push(` Name: ${world.world.name}`);
|
|
70
|
+
lines.push(` ID: ${world.world.world_id}`);
|
|
71
|
+
lines.push(` Version: ${world.world.version}`);
|
|
72
|
+
lines.push(` Created: ${world.metadata.created_at || "\u2014"}`);
|
|
73
|
+
lines.push(` Modified: ${world.metadata.last_modified || "\u2014"}`);
|
|
74
|
+
lines.push(` Authoring: ${world.metadata.authoring_method}`);
|
|
75
|
+
lines.push("");
|
|
76
|
+
lines.push("COMPONENTS");
|
|
77
|
+
lines.push("\u2500".repeat(40));
|
|
78
|
+
lines.push(` Invariants: ${world.invariants.length}`);
|
|
79
|
+
lines.push(` Guards: ${world.guards?.guards.length ?? 0}`);
|
|
80
|
+
lines.push(` Rules: ${world.rules.length}`);
|
|
81
|
+
lines.push(` Roles: ${world.roles?.roles.length ?? 0}`);
|
|
82
|
+
if (world.kernel) {
|
|
83
|
+
const k = world.kernel;
|
|
84
|
+
const totalRules = (k.input_boundaries?.forbidden_patterns?.length ?? 0) + (k.output_boundaries?.forbidden_patterns?.length ?? 0);
|
|
85
|
+
lines.push(` Kernel: ${totalRules} rules`);
|
|
86
|
+
}
|
|
87
|
+
lines.push("");
|
|
88
|
+
lines.push("HEALTH");
|
|
89
|
+
lines.push("\u2500".repeat(40));
|
|
90
|
+
const sev = report.summary;
|
|
91
|
+
const healthIcon = sev.errors === 0 && sev.warnings === 0 ? "HEALTHY" : sev.errors > 0 ? "ISSUES FOUND" : "WARNINGS";
|
|
92
|
+
lines.push(` Status: ${healthIcon}`);
|
|
93
|
+
lines.push(` Errors: ${sev.errors}`);
|
|
94
|
+
lines.push(` Warnings: ${sev.warnings}`);
|
|
95
|
+
lines.push(` Info: ${sev.info}`);
|
|
96
|
+
if (report.findings.length > 0) {
|
|
97
|
+
lines.push("");
|
|
98
|
+
lines.push(" Top findings:");
|
|
99
|
+
for (const f of report.findings.slice(0, 5)) {
|
|
100
|
+
const icon = f.severity === "error" ? "!" : f.severity === "warning" ? "?" : "-";
|
|
101
|
+
lines.push(` [${icon}] ${f.message}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
process.stdout.write(lines.join("\n") + "\n");
|
|
105
|
+
}
|
|
106
|
+
async function worldDiff(path1, path2, json) {
|
|
107
|
+
const world1 = await loadWorld(path1);
|
|
108
|
+
const world2 = await loadWorld(path2);
|
|
109
|
+
const diff = computeWorldDiff(world1, world2);
|
|
110
|
+
if (json) {
|
|
111
|
+
process.stdout.write(JSON.stringify(diff, null, 2) + "\n");
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const lines = [];
|
|
115
|
+
lines.push("WORLD DIFF");
|
|
116
|
+
lines.push("\u2550".repeat(50));
|
|
117
|
+
lines.push(` A: ${world1.world.name} v${world1.world.version}`);
|
|
118
|
+
lines.push(` B: ${world2.world.name} v${world2.world.version}`);
|
|
119
|
+
lines.push("");
|
|
120
|
+
for (const change of diff.changes) {
|
|
121
|
+
const icon = change.type === "added" ? "+" : change.type === "removed" ? "-" : "~";
|
|
122
|
+
lines.push(` [${icon}] ${change.component}: ${change.description}`);
|
|
123
|
+
}
|
|
124
|
+
if (diff.changes.length === 0) {
|
|
125
|
+
lines.push(" No differences found.");
|
|
126
|
+
}
|
|
127
|
+
process.stdout.write(lines.join("\n") + "\n");
|
|
128
|
+
}
|
|
129
|
+
function computeWorldDiff(a, b) {
|
|
130
|
+
const changes = [];
|
|
131
|
+
if (a.world.version !== b.world.version) {
|
|
132
|
+
changes.push({ type: "changed", component: "version", description: `${a.world.version} \u2192 ${b.world.version}` });
|
|
133
|
+
}
|
|
134
|
+
const aInvIds = new Set(a.invariants.map((i) => i.id));
|
|
135
|
+
const bInvIds = new Set(b.invariants.map((i) => i.id));
|
|
136
|
+
for (const id of bInvIds) {
|
|
137
|
+
if (!aInvIds.has(id)) changes.push({ type: "added", component: "invariant", description: id });
|
|
138
|
+
}
|
|
139
|
+
for (const id of aInvIds) {
|
|
140
|
+
if (!bInvIds.has(id)) changes.push({ type: "removed", component: "invariant", description: id });
|
|
141
|
+
}
|
|
142
|
+
const aGuardIds = new Set((a.guards?.guards ?? []).map((g) => g.id));
|
|
143
|
+
const bGuardIds = new Set((b.guards?.guards ?? []).map((g) => g.id));
|
|
144
|
+
for (const id of bGuardIds) {
|
|
145
|
+
if (!aGuardIds.has(id)) changes.push({ type: "added", component: "guard", description: id });
|
|
146
|
+
}
|
|
147
|
+
for (const id of aGuardIds) {
|
|
148
|
+
if (!bGuardIds.has(id)) changes.push({ type: "removed", component: "guard", description: id });
|
|
149
|
+
}
|
|
150
|
+
const aRuleIds = new Set(a.rules.map((r) => r.id));
|
|
151
|
+
const bRuleIds = new Set(b.rules.map((r) => r.id));
|
|
152
|
+
for (const id of bRuleIds) {
|
|
153
|
+
if (!aRuleIds.has(id)) changes.push({ type: "added", component: "rule", description: id });
|
|
154
|
+
}
|
|
155
|
+
for (const id of aRuleIds) {
|
|
156
|
+
if (!bRuleIds.has(id)) changes.push({ type: "removed", component: "rule", description: id });
|
|
157
|
+
}
|
|
158
|
+
const aRoleIds = new Set((a.roles?.roles ?? []).map((r) => r.id));
|
|
159
|
+
const bRoleIds = new Set((b.roles?.roles ?? []).map((r) => r.id));
|
|
160
|
+
for (const id of bRoleIds) {
|
|
161
|
+
if (!aRoleIds.has(id)) changes.push({ type: "added", component: "role", description: id });
|
|
162
|
+
}
|
|
163
|
+
for (const id of aRoleIds) {
|
|
164
|
+
if (!bRoleIds.has(id)) changes.push({ type: "removed", component: "role", description: id });
|
|
165
|
+
}
|
|
166
|
+
const aGuardCount = a.guards?.guards.length ?? 0;
|
|
167
|
+
const bGuardCount = b.guards?.guards.length ?? 0;
|
|
168
|
+
if (aGuardCount !== bGuardCount && changes.filter((c) => c.component === "guard").length === 0) {
|
|
169
|
+
changes.push({ type: "changed", component: "guards", description: `${aGuardCount} \u2192 ${bGuardCount}` });
|
|
170
|
+
}
|
|
171
|
+
return { changes };
|
|
172
|
+
}
|
|
173
|
+
async function worldSnapshot(worldPath) {
|
|
174
|
+
const { readdir, readFile, mkdir, writeFile } = await import("fs/promises");
|
|
175
|
+
const { join } = await import("path");
|
|
176
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
177
|
+
const snapshotDir = join(worldPath, ".snapshots", timestamp);
|
|
178
|
+
await mkdir(snapshotDir, { recursive: true });
|
|
179
|
+
const files = await readdir(worldPath);
|
|
180
|
+
let copied = 0;
|
|
181
|
+
for (const file of files) {
|
|
182
|
+
if (file.endsWith(".json")) {
|
|
183
|
+
const content = await readFile(join(worldPath, file), "utf-8");
|
|
184
|
+
await writeFile(join(snapshotDir, file), content, "utf-8");
|
|
185
|
+
copied++;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
const rulesDir = join(worldPath, "rules");
|
|
190
|
+
const ruleFiles = await readdir(rulesDir);
|
|
191
|
+
await mkdir(join(snapshotDir, "rules"), { recursive: true });
|
|
192
|
+
for (const file of ruleFiles) {
|
|
193
|
+
if (file.endsWith(".json")) {
|
|
194
|
+
const content = await readFile(join(rulesDir, file), "utf-8");
|
|
195
|
+
await writeFile(join(snapshotDir, "rules", file), content, "utf-8");
|
|
196
|
+
copied++;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
} catch {
|
|
200
|
+
}
|
|
201
|
+
process.stdout.write(`Snapshot saved: ${snapshotDir}
|
|
202
|
+
`);
|
|
203
|
+
process.stdout.write(`Files: ${copied}
|
|
204
|
+
`);
|
|
205
|
+
}
|
|
206
|
+
async function worldRollback(worldPath) {
|
|
207
|
+
const { readdir, readFile, writeFile, mkdir } = await import("fs/promises");
|
|
208
|
+
const { join } = await import("path");
|
|
209
|
+
const snapshotsDir = join(worldPath, ".snapshots");
|
|
210
|
+
let snapshots;
|
|
211
|
+
try {
|
|
212
|
+
snapshots = (await readdir(snapshotsDir)).sort();
|
|
213
|
+
} catch {
|
|
214
|
+
process.stderr.write("No snapshots found. Run `neuroverse world snapshot` first.\n");
|
|
215
|
+
process.exit(1);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (snapshots.length === 0) {
|
|
219
|
+
process.stderr.write("No snapshots found. Run `neuroverse world snapshot` first.\n");
|
|
220
|
+
process.exit(1);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const latest = snapshots[snapshots.length - 1];
|
|
224
|
+
const snapshotDir = join(snapshotsDir, latest);
|
|
225
|
+
const backupTimestamp = "pre-rollback-" + (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
226
|
+
const backupDir = join(snapshotsDir, backupTimestamp);
|
|
227
|
+
await mkdir(backupDir, { recursive: true });
|
|
228
|
+
const currentFiles = await readdir(worldPath);
|
|
229
|
+
for (const file of currentFiles) {
|
|
230
|
+
if (file.endsWith(".json")) {
|
|
231
|
+
const content = await readFile(join(worldPath, file), "utf-8");
|
|
232
|
+
await writeFile(join(backupDir, file), content, "utf-8");
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
const snapshotFiles = await readdir(snapshotDir);
|
|
236
|
+
let restored = 0;
|
|
237
|
+
for (const file of snapshotFiles) {
|
|
238
|
+
if (file.endsWith(".json")) {
|
|
239
|
+
const content = await readFile(join(snapshotDir, file), "utf-8");
|
|
240
|
+
await writeFile(join(worldPath, file), content, "utf-8");
|
|
241
|
+
restored++;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
try {
|
|
245
|
+
const rulesDir = join(snapshotDir, "rules");
|
|
246
|
+
const ruleFiles = await readdir(rulesDir);
|
|
247
|
+
await mkdir(join(worldPath, "rules"), { recursive: true });
|
|
248
|
+
for (const file of ruleFiles) {
|
|
249
|
+
if (file.endsWith(".json")) {
|
|
250
|
+
const content = await readFile(join(rulesDir, file), "utf-8");
|
|
251
|
+
await writeFile(join(worldPath, "rules", file), content, "utf-8");
|
|
252
|
+
restored++;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
} catch {
|
|
256
|
+
}
|
|
257
|
+
process.stdout.write(`Rolled back to: ${latest}
|
|
258
|
+
`);
|
|
259
|
+
process.stdout.write(`Restored: ${restored} files
|
|
260
|
+
`);
|
|
261
|
+
process.stdout.write(`Backup saved: ${backupDir}
|
|
262
|
+
`);
|
|
263
|
+
}
|
|
264
|
+
function worldList(json) {
|
|
265
|
+
const worlds = listWorlds();
|
|
266
|
+
if (json) {
|
|
267
|
+
process.stdout.write(JSON.stringify({ worlds, activeWorld: getActiveWorldName() }, null, 2) + "\n");
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
if (worlds.length === 0) {
|
|
271
|
+
process.stdout.write("No worlds found.\n");
|
|
272
|
+
process.stdout.write("Run `neuroverse build <input.md>` to create one.\n");
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
const lines = [];
|
|
276
|
+
lines.push("AVAILABLE WORLDS");
|
|
277
|
+
lines.push("\u2500".repeat(40));
|
|
278
|
+
for (const w of worlds) {
|
|
279
|
+
const marker = w.active ? "\u2192" : " ";
|
|
280
|
+
const activeLabel = w.active ? " (active)" : "";
|
|
281
|
+
lines.push(` ${marker} ${w.name}${activeLabel}`);
|
|
282
|
+
}
|
|
283
|
+
const envWorld = process.env.NEUROVERSE_WORLD;
|
|
284
|
+
if (envWorld) {
|
|
285
|
+
lines.push("");
|
|
286
|
+
lines.push(` env: NEUROVERSE_WORLD=${envWorld}`);
|
|
287
|
+
}
|
|
288
|
+
lines.push("");
|
|
289
|
+
lines.push("Switch: neuroverse world use <name>");
|
|
290
|
+
process.stdout.write(lines.join("\n") + "\n");
|
|
291
|
+
}
|
|
292
|
+
function worldUse(name) {
|
|
293
|
+
setActiveWorld(name);
|
|
294
|
+
process.stdout.write(`Active world: ${name}
|
|
295
|
+
`);
|
|
296
|
+
}
|
|
297
|
+
function worldCurrent(json) {
|
|
298
|
+
const info = describeActiveWorld();
|
|
299
|
+
if (json) {
|
|
300
|
+
process.stdout.write(JSON.stringify(info ?? { name: null, source: null }, null, 2) + "\n");
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
if (!info) {
|
|
304
|
+
process.stdout.write("No active world.\n");
|
|
305
|
+
process.stdout.write("Set one with: neuroverse world use <name>\n");
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
process.stdout.write(`Active world: ${info.name}
|
|
309
|
+
`);
|
|
310
|
+
process.stdout.write(`Source: ${info.source}
|
|
311
|
+
`);
|
|
312
|
+
}
|
|
313
|
+
async function main(argv = process.argv.slice(2)) {
|
|
314
|
+
const { subcommand, paths, flags } = parseArgs(argv);
|
|
315
|
+
if (flags.help || !subcommand) {
|
|
316
|
+
process.stdout.write(USAGE + "\n");
|
|
317
|
+
process.exit(0);
|
|
318
|
+
}
|
|
319
|
+
switch (subcommand) {
|
|
320
|
+
case "list":
|
|
321
|
+
case "ls": {
|
|
322
|
+
return worldList(!!flags.json);
|
|
323
|
+
}
|
|
324
|
+
case "use": {
|
|
325
|
+
if (!paths[0]) {
|
|
326
|
+
process.stderr.write("Usage: neuroverse world use <name>\n");
|
|
327
|
+
process.exit(1);
|
|
328
|
+
}
|
|
329
|
+
return worldUse(paths[0]);
|
|
330
|
+
}
|
|
331
|
+
case "current": {
|
|
332
|
+
return worldCurrent(!!flags.json);
|
|
333
|
+
}
|
|
334
|
+
case "status": {
|
|
335
|
+
const ref = paths[0];
|
|
336
|
+
const resolved = ref ? resolveWorldPath(ref) : resolveWorldPath();
|
|
337
|
+
if (!resolved) {
|
|
338
|
+
process.stderr.write("Usage: neuroverse world status <path|name>\n");
|
|
339
|
+
process.stderr.write("Or set an active world: neuroverse world use <name>\n");
|
|
340
|
+
process.exit(1);
|
|
341
|
+
}
|
|
342
|
+
return worldStatus(resolved, !!flags.json);
|
|
343
|
+
}
|
|
344
|
+
case "diff": {
|
|
345
|
+
if (!paths[0] || !paths[1]) {
|
|
346
|
+
process.stderr.write("Usage: neuroverse world diff <path1> <path2>\n");
|
|
347
|
+
process.exit(1);
|
|
348
|
+
}
|
|
349
|
+
return worldDiff(paths[0], paths[1], !!flags.json);
|
|
350
|
+
}
|
|
351
|
+
case "snapshot": {
|
|
352
|
+
if (!paths[0]) {
|
|
353
|
+
process.stderr.write("Usage: neuroverse world snapshot <path>\n");
|
|
354
|
+
process.exit(1);
|
|
355
|
+
}
|
|
356
|
+
return worldSnapshot(paths[0]);
|
|
357
|
+
}
|
|
358
|
+
case "rollback": {
|
|
359
|
+
if (!paths[0]) {
|
|
360
|
+
process.stderr.write("Usage: neuroverse world rollback <path>\n");
|
|
361
|
+
process.exit(1);
|
|
362
|
+
}
|
|
363
|
+
return worldRollback(paths[0]);
|
|
364
|
+
}
|
|
365
|
+
default: {
|
|
366
|
+
process.stderr.write(`Unknown world subcommand: "${subcommand}"
|
|
367
|
+
|
|
368
|
+
`);
|
|
369
|
+
process.stdout.write(USAGE + "\n");
|
|
370
|
+
process.exit(1);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
export {
|
|
375
|
+
main
|
|
376
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_BUNDLED_WORLD,
|
|
3
|
+
loadBundledWorld,
|
|
4
|
+
loadWorld,
|
|
5
|
+
loadWorldFromDirectory
|
|
6
|
+
} from "./chunk-CTZHONLA.js";
|
|
7
|
+
import "./chunk-QWGCMQQD.js";
|
|
8
|
+
export {
|
|
9
|
+
DEFAULT_BUNDLED_WORLD,
|
|
10
|
+
loadBundledWorld,
|
|
11
|
+
loadWorld,
|
|
12
|
+
loadWorldFromDirectory
|
|
13
|
+
};
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
---
|
|
2
|
+
world_id: autoresearch
|
|
3
|
+
name: Autoresearch Governance
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
runtime_mode: SIMULATION
|
|
6
|
+
default_profile: conservative
|
|
7
|
+
alternative_profile: exploratory
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Thesis
|
|
11
|
+
|
|
12
|
+
Autonomous AI research loops must operate within structured governance: experiments are reproducible, metrics are tracked, compute budgets are enforced, and agents cannot drift beyond their declared research context. A research world without constraints produces noise, not knowledge.
|
|
13
|
+
|
|
14
|
+
# Invariants
|
|
15
|
+
|
|
16
|
+
- `experiments_must_be_reproducible` — Every experiment must log architecture, hyperparameters, dataset, and training config sufficient to reproduce results (structural, immutable)
|
|
17
|
+
- `metrics_must_be_recorded` — Every training run must produce at least one evaluation metric; runs without metrics are invalid (structural, immutable)
|
|
18
|
+
- `dataset_must_be_declared` — The dataset used for training and evaluation must be explicitly declared and never changed without governance approval (structural, immutable)
|
|
19
|
+
- `goal_must_be_defined` — The optimization goal (metric + direction) must be defined before any experiment runs (structural, immutable)
|
|
20
|
+
- `no_data_leakage` — Training data must never contaminate evaluation data; train/val/test splits must be fixed (structural, immutable)
|
|
21
|
+
- `compute_budget_enforced` — Experiments must respect declared compute limits; exceeding budget halts the loop (structural, immutable)
|
|
22
|
+
- `architecture_constraints_honored` — If the research context declares architectural constraints, experiments must satisfy them (prompt, immutable)
|
|
23
|
+
|
|
24
|
+
# State
|
|
25
|
+
|
|
26
|
+
## experiments_run
|
|
27
|
+
- type: number
|
|
28
|
+
- min: 0
|
|
29
|
+
- max: 10000
|
|
30
|
+
- step: 1
|
|
31
|
+
- default: 0
|
|
32
|
+
- label: Experiments Run
|
|
33
|
+
- description: Total number of experiments completed in this research loop
|
|
34
|
+
|
|
35
|
+
## best_metric_value
|
|
36
|
+
- type: number
|
|
37
|
+
- min: -1000
|
|
38
|
+
- max: 1000
|
|
39
|
+
- step: 0.01
|
|
40
|
+
- default: 100
|
|
41
|
+
- label: Best Metric Value
|
|
42
|
+
- description: Best value achieved for the primary evaluation metric
|
|
43
|
+
|
|
44
|
+
## keep_rate
|
|
45
|
+
- type: number
|
|
46
|
+
- min: 0
|
|
47
|
+
- max: 100
|
|
48
|
+
- step: 1
|
|
49
|
+
- default: 0
|
|
50
|
+
- label: Keep Rate
|
|
51
|
+
- description: Percentage of experiments that improved upon the previous best result
|
|
52
|
+
|
|
53
|
+
## compute_used_minutes
|
|
54
|
+
- type: number
|
|
55
|
+
- min: 0
|
|
56
|
+
- max: 100000
|
|
57
|
+
- step: 1
|
|
58
|
+
- default: 0
|
|
59
|
+
- label: Compute Used (minutes)
|
|
60
|
+
- description: Total wall-clock training time consumed across all experiments
|
|
61
|
+
|
|
62
|
+
## compute_budget_minutes
|
|
63
|
+
- type: number
|
|
64
|
+
- min: 0
|
|
65
|
+
- max: 100000
|
|
66
|
+
- step: 60
|
|
67
|
+
- default: 1440
|
|
68
|
+
- label: Compute Budget (minutes)
|
|
69
|
+
- description: Maximum allowed wall-clock training time for the research loop
|
|
70
|
+
|
|
71
|
+
## research_context_drift
|
|
72
|
+
- type: number
|
|
73
|
+
- min: 0
|
|
74
|
+
- max: 100
|
|
75
|
+
- step: 1
|
|
76
|
+
- default: 0
|
|
77
|
+
- label: Context Drift
|
|
78
|
+
- description: Degree to which recent experiments have diverged from the declared research context. 0 = on-topic. 100 = unrelated.
|
|
79
|
+
|
|
80
|
+
## metric_improvement_rate
|
|
81
|
+
- type: number
|
|
82
|
+
- min: 0
|
|
83
|
+
- max: 100
|
|
84
|
+
- step: 1
|
|
85
|
+
- default: 0
|
|
86
|
+
- label: Improvement Rate
|
|
87
|
+
- description: Rate of metric improvement over the last 10 experiments. 0 = stagnant. 100 = rapid improvement.
|
|
88
|
+
|
|
89
|
+
## failed_experiments
|
|
90
|
+
- type: number
|
|
91
|
+
- min: 0
|
|
92
|
+
- max: 10000
|
|
93
|
+
- step: 1
|
|
94
|
+
- default: 0
|
|
95
|
+
- label: Failed Experiments
|
|
96
|
+
- description: Number of experiments that crashed, timed out, or produced no valid metrics
|
|
97
|
+
|
|
98
|
+
# Assumptions
|
|
99
|
+
|
|
100
|
+
## conservative
|
|
101
|
+
- name: Conservative Research
|
|
102
|
+
- description: Prioritize reproducibility and careful iteration. Small architectural changes per experiment. Strict compute limits. Reject experiments that drift from the research context.
|
|
103
|
+
- iteration_style: incremental
|
|
104
|
+
- drift_tolerance: low
|
|
105
|
+
- compute_strictness: high
|
|
106
|
+
- failure_tolerance: low
|
|
107
|
+
|
|
108
|
+
## exploratory
|
|
109
|
+
- name: Exploratory Research
|
|
110
|
+
- description: Allow broader architectural exploration. Larger jumps between experiments. More lenient compute budget. Accept higher context drift if metrics improve.
|
|
111
|
+
- iteration_style: explorative
|
|
112
|
+
- drift_tolerance: moderate
|
|
113
|
+
- compute_strictness: moderate
|
|
114
|
+
- failure_tolerance: moderate
|
|
115
|
+
|
|
116
|
+
# Rules
|
|
117
|
+
|
|
118
|
+
## rule-001: Compute Budget Exhausted (structural)
|
|
119
|
+
When compute budget is exceeded, the research loop must halt. No further experiments are allowed.
|
|
120
|
+
|
|
121
|
+
When compute_used_minutes > compute_budget_minutes [state]
|
|
122
|
+
Then research_viability *= 0.00
|
|
123
|
+
Collapse: research_viability < 0.05
|
|
124
|
+
|
|
125
|
+
> trigger: Compute usage exceeds declared budget — no training time remains.
|
|
126
|
+
> rule: Unbounded compute makes research ungovernable. The budget is a hard constraint, not a suggestion.
|
|
127
|
+
> shift: Research loop halts. Final results are reported. No new experiments start.
|
|
128
|
+
> effect: Research viability set to zero. Loop terminated.
|
|
129
|
+
|
|
130
|
+
## rule-002: High Failure Rate (degradation)
|
|
131
|
+
Too many failed experiments indicate a systemic problem — bad code, misconfigured environment, or impossible architecture.
|
|
132
|
+
|
|
133
|
+
When failed_experiments > 5 [state] AND experiments_run > 0 [state]
|
|
134
|
+
Then research_viability *= 0.50
|
|
135
|
+
|
|
136
|
+
> trigger: More than 5 experiments have failed — possible systemic issue.
|
|
137
|
+
> rule: Failures consume compute without producing knowledge. High failure rates signal infrastructure problems, not research progress.
|
|
138
|
+
> shift: Research viability degrades. Agent should investigate root cause before continuing.
|
|
139
|
+
> effect: Research viability reduced to 50%.
|
|
140
|
+
|
|
141
|
+
## rule-003: Context Drift Warning (degradation)
|
|
142
|
+
Experiments diverging from the declared research context waste compute and produce irrelevant results.
|
|
143
|
+
|
|
144
|
+
When research_context_drift > 40 [state]
|
|
145
|
+
Then research_viability *= 0.60
|
|
146
|
+
|
|
147
|
+
> trigger: Context drift above 40% — experiments are straying from the research topic.
|
|
148
|
+
> rule: Governance exists to keep research focused. Agents exploring unrelated architectures are not contributing to the declared goal.
|
|
149
|
+
> shift: Research viability degrades. Agent must return to the declared research context.
|
|
150
|
+
> effect: Research viability reduced to 60%.
|
|
151
|
+
|
|
152
|
+
## rule-004: Metric Stagnation (degradation)
|
|
153
|
+
When experiments stop improving the primary metric, the research approach may need fundamental revision.
|
|
154
|
+
|
|
155
|
+
When metric_improvement_rate < 5 [state] AND experiments_run > 10 [state]
|
|
156
|
+
Then research_viability *= 0.70
|
|
157
|
+
|
|
158
|
+
> trigger: Improvement rate below 5% after 10+ experiments — research may have plateaued.
|
|
159
|
+
> rule: Stagnant metrics indicate diminishing returns from the current approach. The agent should consider a strategy change.
|
|
160
|
+
> shift: Research viability degrades. Agent should try a substantially different approach or conclude the loop.
|
|
161
|
+
> effect: Research viability reduced to 70%.
|
|
162
|
+
|
|
163
|
+
## rule-005: Strong Progress (advantage)
|
|
164
|
+
Consistent metric improvement validates the research approach and warrants continued investment.
|
|
165
|
+
|
|
166
|
+
When metric_improvement_rate > 30 [state] AND keep_rate > 20 [state]
|
|
167
|
+
Then research_viability *= 1.20
|
|
168
|
+
|
|
169
|
+
> trigger: Improvement rate above 30% with keep rate above 20% — research is productive.
|
|
170
|
+
> rule: Productive research should be encouraged. Strong metric trends indicate a promising research direction.
|
|
171
|
+
> shift: Research viability improves. Continued experimentation is well-justified.
|
|
172
|
+
> effect: Research viability boosted by 20%.
|
|
173
|
+
|
|
174
|
+
## rule-006: No Metrics Recorded (structural)
|
|
175
|
+
An experiment that produces no evaluation metrics is invalid and must not count as progress.
|
|
176
|
+
|
|
177
|
+
When experiments_run > 0 [state] AND best_metric_value == 100 [state]
|
|
178
|
+
Then research_viability *= 0.30
|
|
179
|
+
Collapse: research_viability < 0.05
|
|
180
|
+
|
|
181
|
+
> trigger: Experiments have run but no metric improvement from default — metrics may not be recording.
|
|
182
|
+
> rule: Research without measurement is not research. Every experiment must produce at least one evaluation metric.
|
|
183
|
+
> shift: Research viability drops sharply. Agent must fix metric recording before continuing.
|
|
184
|
+
> effect: Research viability reduced to 30%.
|
|
185
|
+
|
|
186
|
+
## rule-007: Efficient Compute Usage (advantage)
|
|
187
|
+
High keep rate with low compute usage indicates efficient research methodology.
|
|
188
|
+
|
|
189
|
+
When keep_rate > 30 [state] AND compute_used_minutes < compute_budget_minutes [state]
|
|
190
|
+
Then research_viability *= 1.15
|
|
191
|
+
|
|
192
|
+
> trigger: Keep rate above 30% with compute budget remaining — efficient experimentation.
|
|
193
|
+
> rule: Efficient use of compute demonstrates disciplined research. Not every experiment needs to be expensive.
|
|
194
|
+
> shift: Research viability improves. The research methodology is sustainable.
|
|
195
|
+
> effect: Research viability boosted by 15%.
|
|
196
|
+
|
|
197
|
+
# Gates
|
|
198
|
+
|
|
199
|
+
- BREAKTHROUGH: research_viability >= 90
|
|
200
|
+
- PRODUCTIVE: research_viability >= 60
|
|
201
|
+
- ONGOING: research_viability >= 35
|
|
202
|
+
- STRUGGLING: research_viability > 10
|
|
203
|
+
- HALTED: research_viability <= 10
|
|
204
|
+
|
|
205
|
+
# Outcomes
|
|
206
|
+
|
|
207
|
+
## research_viability
|
|
208
|
+
- type: number
|
|
209
|
+
- range: 0-100
|
|
210
|
+
- display: percentage
|
|
211
|
+
- label: Research Viability
|
|
212
|
+
- primary: true
|
|
213
|
+
|
|
214
|
+
## best_metric_value
|
|
215
|
+
- type: number
|
|
216
|
+
- range: -1000-1000
|
|
217
|
+
- display: decimal
|
|
218
|
+
- label: Best Metric Value
|
|
219
|
+
|
|
220
|
+
## keep_rate
|
|
221
|
+
- type: number
|
|
222
|
+
- range: 0-100
|
|
223
|
+
- display: percentage
|
|
224
|
+
- label: Keep Rate
|
|
225
|
+
|
|
226
|
+
## experiments_run
|
|
227
|
+
- type: number
|
|
228
|
+
- range: 0-10000
|
|
229
|
+
- display: integer
|
|
230
|
+
- label: Experiments Run
|