@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.
- package/package.json +4 -2
- package/policies/content-moderation-rules.txt +8 -0
- package/policies/marketing-rules.txt +8 -0
- package/policies/science-research-rules.txt +11 -0
- package/policies/social-media-rules.txt +7 -0
- package/policies/strict-rules.txt +8 -0
- package/policies/trading-rules.txt +8 -0
- package/simulate.html +1899 -0
- package/dist/adapters/autoresearch.cjs +0 -196
- package/dist/adapters/autoresearch.d.cts +0 -103
- package/dist/adapters/autoresearch.d.ts +0 -103
- package/dist/adapters/autoresearch.js +0 -7
- package/dist/adapters/deep-agents.cjs +0 -1472
- package/dist/adapters/deep-agents.d.cts +0 -181
- package/dist/adapters/deep-agents.d.ts +0 -181
- package/dist/adapters/deep-agents.js +0 -17
- package/dist/adapters/express.cjs +0 -1196
- package/dist/adapters/express.d.cts +0 -66
- package/dist/adapters/express.d.ts +0 -66
- package/dist/adapters/express.js +0 -12
- package/dist/adapters/index.cjs +0 -2038
- package/dist/adapters/index.d.cts +0 -8
- package/dist/adapters/index.d.ts +0 -8
- package/dist/adapters/index.js +0 -68
- package/dist/adapters/langchain.cjs +0 -1259
- package/dist/adapters/langchain.d.cts +0 -89
- package/dist/adapters/langchain.d.ts +0 -89
- package/dist/adapters/langchain.js +0 -17
- package/dist/adapters/openai.cjs +0 -1289
- package/dist/adapters/openai.d.cts +0 -99
- package/dist/adapters/openai.d.ts +0 -99
- package/dist/adapters/openai.js +0 -17
- package/dist/adapters/openclaw.cjs +0 -1281
- package/dist/adapters/openclaw.d.cts +0 -99
- package/dist/adapters/openclaw.d.ts +0 -99
- package/dist/adapters/openclaw.js +0 -17
- package/dist/bootstrap-GXVDZNF7.js +0 -114
- package/dist/build-X5MZY4IA.js +0 -339
- package/dist/chunk-4L6OPKMQ.js +0 -100
- package/dist/chunk-4NGDRRQH.js +0 -10
- package/dist/chunk-5U2MQO5P.js +0 -57
- package/dist/chunk-6BB55YJI.js +0 -113
- package/dist/chunk-6CZSKEY5.js +0 -164
- package/dist/chunk-7P3S7MAY.js +0 -1090
- package/dist/chunk-A5W4GNQO.js +0 -130
- package/dist/chunk-AF2VX4AL.js +0 -363
- package/dist/chunk-AKW5YVCE.js +0 -96
- package/dist/chunk-BMOXICAB.js +0 -340
- package/dist/chunk-BQZMOEML.js +0 -43
- package/dist/chunk-D2UCV5AK.js +0 -326
- package/dist/chunk-EVDJUSZ2.js +0 -91
- package/dist/chunk-FYS2CBUW.js +0 -304
- package/dist/chunk-I3RRAYK2.js +0 -11
- package/dist/chunk-IZSO75NZ.js +0 -792
- package/dist/chunk-JCKSW2PZ.js +0 -304
- package/dist/chunk-JZPQGIKR.js +0 -79
- package/dist/chunk-KTFTTLTP.js +0 -246
- package/dist/chunk-MH7BT4VH.js +0 -15
- package/dist/chunk-ORJ3NOE6.js +0 -622
- package/dist/chunk-OT6PXH54.js +0 -61
- package/dist/chunk-Q6O7ZLO2.js +0 -62
- package/dist/chunk-QLPTHTVB.js +0 -253
- package/dist/chunk-REXY4LUL.js +0 -226
- package/dist/chunk-T5EUJQE5.js +0 -172
- package/dist/chunk-TTBKTF3P.js +0 -608
- package/dist/chunk-XPDMYECO.js +0 -642
- package/dist/chunk-YZFATT7X.js +0 -9
- package/dist/chunk-ZIVQNSZU.js +0 -119
- package/dist/chunk-ZJTDUCC2.js +0 -194
- package/dist/cli/neuroverse.cjs +0 -12564
- package/dist/cli/neuroverse.d.cts +0 -1
- package/dist/cli/neuroverse.d.ts +0 -1
- package/dist/cli/neuroverse.js +0 -208
- package/dist/cli/plan.cjs +0 -1686
- package/dist/cli/plan.d.cts +0 -20
- package/dist/cli/plan.d.ts +0 -20
- package/dist/cli/plan.js +0 -353
- package/dist/cli/run.cjs +0 -1945
- package/dist/cli/run.d.cts +0 -20
- package/dist/cli/run.d.ts +0 -20
- package/dist/cli/run.js +0 -143
- package/dist/configure-ai-TK67ZWZL.js +0 -132
- package/dist/decision-flow-LETV5NWY.js +0 -61
- package/dist/derive-7365SUFU.js +0 -152
- package/dist/doctor-QYISMKEL.js +0 -173
- package/dist/equity-penalties-63FGB3I2.js +0 -244
- package/dist/explain-A2EWI2OL.js +0 -51
- package/dist/guard-3BWL3IGH.js +0 -92
- package/dist/guard-contract-C9_zKbzd.d.cts +0 -821
- package/dist/guard-contract-C9_zKbzd.d.ts +0 -821
- package/dist/guard-engine-QFMIBWJY.js +0 -10
- package/dist/impact-UB6DXKSX.js +0 -59
- package/dist/improve-XZA57GER.js +0 -66
- package/dist/index.cjs +0 -6821
- package/dist/index.d.cts +0 -1829
- package/dist/index.d.ts +0 -1829
- package/dist/index.js +0 -430
- package/dist/infer-world-7GVZWFX4.js +0 -543
- package/dist/init-PKPIYHYE.js +0 -144
- package/dist/init-world-VWMQZQC7.js +0 -223
- package/dist/mcp-server-XWQZXNW7.js +0 -13
- package/dist/model-adapter-BB7G4MFI.js +0 -11
- package/dist/playground-ADWZORNV.js +0 -550
- package/dist/redteam-JRQ7FD2F.js +0 -357
- package/dist/session-MMYX5YCF.js +0 -15
- package/dist/shared--Q8wPBVN.d.ts +0 -60
- package/dist/shared-HpAG90PX.d.cts +0 -60
- package/dist/shared-U2QFV7JH.js +0 -16
- package/dist/simulate-GMIFFXYV.js +0 -83
- package/dist/test-JBBZ65X4.js +0 -217
- package/dist/trace-3MYWIDEF.js +0 -166
- package/dist/validate-LLBWVPGV.js +0 -81
- package/dist/validate-engine-UIABSIHD.js +0 -7
- package/dist/world-BFJCIQSH.js +0 -378
- package/dist/world-loader-HMPTOEA2.js +0 -9
- package/dist/worlds/autoresearch.nv-world.md +0 -230
- package/dist/worlds/coding-agent.nv-world.md +0 -211
- package/dist/worlds/derivation-world.nv-world.md +0 -278
package/dist/cli/run.d.cts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* neuroverse run — Governed Runtime
|
|
3
|
-
*
|
|
4
|
-
* Modes:
|
|
5
|
-
* --pipe Pipe mode: JSON lines in → verdicts out (default if stdin is piped)
|
|
6
|
-
* --interactive Interactive chat session with a model
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* # Pipe mode — works with any language/framework
|
|
10
|
-
* my_agent | neuroverse run --world ./world/ --plan plan.json
|
|
11
|
-
*
|
|
12
|
-
* # Interactive mode — governed chat session
|
|
13
|
-
* neuroverse run --world ./world/ --plan plan.json --provider openai
|
|
14
|
-
*
|
|
15
|
-
* # Quick start — auto-detect world and plan
|
|
16
|
-
* neuroverse run
|
|
17
|
-
*/
|
|
18
|
-
declare function main(args: string[]): Promise<void>;
|
|
19
|
-
|
|
20
|
-
export { main };
|
package/dist/cli/run.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* neuroverse run — Governed Runtime
|
|
3
|
-
*
|
|
4
|
-
* Modes:
|
|
5
|
-
* --pipe Pipe mode: JSON lines in → verdicts out (default if stdin is piped)
|
|
6
|
-
* --interactive Interactive chat session with a model
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* # Pipe mode — works with any language/framework
|
|
10
|
-
* my_agent | neuroverse run --world ./world/ --plan plan.json
|
|
11
|
-
*
|
|
12
|
-
* # Interactive mode — governed chat session
|
|
13
|
-
* neuroverse run --world ./world/ --plan plan.json --provider openai
|
|
14
|
-
*
|
|
15
|
-
* # Quick start — auto-detect world and plan
|
|
16
|
-
* neuroverse run
|
|
17
|
-
*/
|
|
18
|
-
declare function main(args: string[]): Promise<void>;
|
|
19
|
-
|
|
20
|
-
export { main };
|
package/dist/cli/run.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
describeActiveWorld,
|
|
3
|
-
resolveWorldPath
|
|
4
|
-
} from "../chunk-AKW5YVCE.js";
|
|
5
|
-
import "../chunk-YZFATT7X.js";
|
|
6
|
-
|
|
7
|
-
// src/cli/run.ts
|
|
8
|
-
import { readFileSync, readdirSync, existsSync } from "fs";
|
|
9
|
-
import { join } from "path";
|
|
10
|
-
function parseArg(args, flag) {
|
|
11
|
-
const idx = args.indexOf(flag);
|
|
12
|
-
return idx >= 0 && idx + 1 < args.length ? args[idx + 1] : void 0;
|
|
13
|
-
}
|
|
14
|
-
function hasFlag(args, flag) {
|
|
15
|
-
return args.includes(flag);
|
|
16
|
-
}
|
|
17
|
-
function autoDetectPlan() {
|
|
18
|
-
const nvDir = ".neuroverse/plans";
|
|
19
|
-
if (!existsSync(nvDir)) return void 0;
|
|
20
|
-
const entries = readdirSync(nvDir).filter((e) => e.endsWith(".json"));
|
|
21
|
-
if (entries.length === 1) {
|
|
22
|
-
try {
|
|
23
|
-
return JSON.parse(readFileSync(join(nvDir, entries[0]), "utf-8"));
|
|
24
|
-
} catch {
|
|
25
|
-
return void 0;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return void 0;
|
|
29
|
-
}
|
|
30
|
-
function loadPlan(path) {
|
|
31
|
-
return JSON.parse(readFileSync(path, "utf-8"));
|
|
32
|
-
}
|
|
33
|
-
var RUN_USAGE = `
|
|
34
|
-
neuroverse run \u2014 Governed runtime for AI agents.
|
|
35
|
-
|
|
36
|
-
Modes:
|
|
37
|
-
--pipe JSON lines in \u2192 verdicts out (default if stdin is piped)
|
|
38
|
-
--interactive Chat session with model + governance
|
|
39
|
-
|
|
40
|
-
Options:
|
|
41
|
-
--world <path> Path to world directory
|
|
42
|
-
--plan <path> Path to plan.json
|
|
43
|
-
--level <level> Enforcement level (basic|standard|strict)
|
|
44
|
-
--trace Include evaluation trace in verdicts
|
|
45
|
-
--provider <name> Model provider (openai|anthropic|ollama)
|
|
46
|
-
--model <name> Model name override
|
|
47
|
-
--api-key <key> API key (or set via env var)
|
|
48
|
-
|
|
49
|
-
Usage:
|
|
50
|
-
# Pipe mode \u2014 works with any agent
|
|
51
|
-
my_agent | neuroverse run --world ./world/ --plan plan.json
|
|
52
|
-
|
|
53
|
-
# Interactive mode \u2014 governed chat session
|
|
54
|
-
neuroverse run --interactive --world ./world/ --provider openai
|
|
55
|
-
|
|
56
|
-
# Auto-detect world and plan
|
|
57
|
-
neuroverse run
|
|
58
|
-
`.trim();
|
|
59
|
-
async function main(args) {
|
|
60
|
-
if (hasFlag(args, "--help") || hasFlag(args, "-h")) {
|
|
61
|
-
process.stdout.write(RUN_USAGE + "\n");
|
|
62
|
-
process.exit(0);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const worldPath = resolveWorldPath(parseArg(args, "--world"));
|
|
66
|
-
if (!worldPath) {
|
|
67
|
-
process.stderr.write(
|
|
68
|
-
"Error: No world found.\nUse --world <path>, set NEUROVERSE_WORLD, or run `neuroverse world use <name>`\n"
|
|
69
|
-
);
|
|
70
|
-
process.exit(1);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const explicitWorld = parseArg(args, "--world");
|
|
74
|
-
const worldInfo = describeActiveWorld(explicitWorld);
|
|
75
|
-
if (worldInfo) {
|
|
76
|
-
process.stderr.write(`Using world: ${worldInfo.name}
|
|
77
|
-
`);
|
|
78
|
-
}
|
|
79
|
-
const planPath = parseArg(args, "--plan");
|
|
80
|
-
const plan = planPath ? loadPlan(planPath) : autoDetectPlan();
|
|
81
|
-
const level = parseArg(args, "--level");
|
|
82
|
-
const trace = hasFlag(args, "--trace");
|
|
83
|
-
const isPipeMode = hasFlag(args, "--pipe") || !process.stdin.isTTY;
|
|
84
|
-
const isInteractive = hasFlag(args, "--interactive");
|
|
85
|
-
if (isInteractive) {
|
|
86
|
-
const providerName = parseArg(args, "--provider");
|
|
87
|
-
if (!providerName) {
|
|
88
|
-
process.stderr.write(
|
|
89
|
-
"Error: Interactive mode requires --provider (openai|anthropic|ollama)\n"
|
|
90
|
-
);
|
|
91
|
-
process.exit(1);
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
const { resolveProvider, ModelAdapter } = await import("../model-adapter-BB7G4MFI.js");
|
|
95
|
-
const { runInteractiveMode } = await import("../session-MMYX5YCF.js");
|
|
96
|
-
const modelConfig = resolveProvider(providerName, {
|
|
97
|
-
model: parseArg(args, "--model"),
|
|
98
|
-
apiKey: parseArg(args, "--api-key")
|
|
99
|
-
});
|
|
100
|
-
const model = new ModelAdapter(modelConfig);
|
|
101
|
-
await runInteractiveMode(
|
|
102
|
-
{
|
|
103
|
-
worldPath,
|
|
104
|
-
plan,
|
|
105
|
-
level,
|
|
106
|
-
trace,
|
|
107
|
-
onVerdict: (verdict, event) => {
|
|
108
|
-
if (verdict.status !== "ALLOW") {
|
|
109
|
-
process.stderr.write(
|
|
110
|
-
` [${verdict.status}] ${event.intent} \u2014 ${verdict.reason ?? verdict.ruleId ?? "governance rule"}
|
|
111
|
-
`
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
onPlanProgress: (progress) => {
|
|
116
|
-
process.stderr.write(
|
|
117
|
-
` [plan] ${progress.completed}/${progress.total} (${progress.percentage}%)
|
|
118
|
-
`
|
|
119
|
-
);
|
|
120
|
-
},
|
|
121
|
-
onPlanComplete: () => {
|
|
122
|
-
process.stderr.write(` [plan] Complete!
|
|
123
|
-
`);
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
model
|
|
127
|
-
);
|
|
128
|
-
} else if (isPipeMode) {
|
|
129
|
-
const { runPipeMode } = await import("../session-MMYX5YCF.js");
|
|
130
|
-
await runPipeMode({
|
|
131
|
-
worldPath,
|
|
132
|
-
plan,
|
|
133
|
-
level,
|
|
134
|
-
trace
|
|
135
|
-
});
|
|
136
|
-
} else {
|
|
137
|
-
process.stdout.write(RUN_USAGE + "\n");
|
|
138
|
-
process.exit(0);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
export {
|
|
142
|
-
main
|
|
143
|
-
};
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CONFIGURE_AI_EXIT_CODES,
|
|
3
|
-
createProvider
|
|
4
|
-
} from "./chunk-Q6O7ZLO2.js";
|
|
5
|
-
import {
|
|
6
|
-
getConfigPath,
|
|
7
|
-
loadConfig,
|
|
8
|
-
redactConfig,
|
|
9
|
-
saveConfig
|
|
10
|
-
} from "./chunk-OT6PXH54.js";
|
|
11
|
-
import "./chunk-YZFATT7X.js";
|
|
12
|
-
|
|
13
|
-
// src/cli/configure-ai.ts
|
|
14
|
-
function parseArgs(argv) {
|
|
15
|
-
let provider;
|
|
16
|
-
let model;
|
|
17
|
-
let apiKey;
|
|
18
|
-
let endpoint;
|
|
19
|
-
let show = false;
|
|
20
|
-
let test = false;
|
|
21
|
-
for (let i = 0; i < argv.length; i++) {
|
|
22
|
-
const arg = argv[i];
|
|
23
|
-
if (arg === "--provider" && i + 1 < argv.length) {
|
|
24
|
-
provider = argv[++i];
|
|
25
|
-
} else if (arg === "--model" && i + 1 < argv.length) {
|
|
26
|
-
model = argv[++i];
|
|
27
|
-
} else if (arg === "--api-key" && i + 1 < argv.length) {
|
|
28
|
-
apiKey = argv[++i];
|
|
29
|
-
} else if (arg === "--endpoint" && i + 1 < argv.length) {
|
|
30
|
-
endpoint = argv[++i];
|
|
31
|
-
} else if (arg === "--show") {
|
|
32
|
-
show = true;
|
|
33
|
-
} else if (arg === "--test") {
|
|
34
|
-
test = true;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return { provider, model, apiKey, endpoint, show, test };
|
|
38
|
-
}
|
|
39
|
-
async function main(argv = process.argv.slice(2)) {
|
|
40
|
-
try {
|
|
41
|
-
const args = parseArgs(argv);
|
|
42
|
-
if (args.show) {
|
|
43
|
-
const config2 = await loadConfig();
|
|
44
|
-
if (!config2) {
|
|
45
|
-
process.stdout.write(JSON.stringify({
|
|
46
|
-
configured: false,
|
|
47
|
-
configPath: getConfigPath()
|
|
48
|
-
}, null, 2) + "\n");
|
|
49
|
-
} else {
|
|
50
|
-
process.stdout.write(JSON.stringify({
|
|
51
|
-
configured: true,
|
|
52
|
-
configPath: getConfigPath(),
|
|
53
|
-
...redactConfig(config2)
|
|
54
|
-
}, null, 2) + "\n");
|
|
55
|
-
}
|
|
56
|
-
process.exit(CONFIGURE_AI_EXIT_CODES.SUCCESS);
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (args.test) {
|
|
60
|
-
const config2 = await loadConfig();
|
|
61
|
-
if (!config2) {
|
|
62
|
-
process.stderr.write(JSON.stringify({
|
|
63
|
-
error: "No configuration found. Run: neuroverse configure-ai --provider ... --model ... --api-key ..."
|
|
64
|
-
}, null, 2) + "\n");
|
|
65
|
-
process.exit(CONFIGURE_AI_EXIT_CODES.VALIDATION_FAIL);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
try {
|
|
69
|
-
const provider = createProvider(config2);
|
|
70
|
-
await provider.complete("You are a test. Respond with only: OK", "Test connection.");
|
|
71
|
-
process.stdout.write(JSON.stringify({
|
|
72
|
-
success: true,
|
|
73
|
-
message: "Connection test passed",
|
|
74
|
-
...redactConfig(config2)
|
|
75
|
-
}, null, 2) + "\n");
|
|
76
|
-
process.exit(CONFIGURE_AI_EXIT_CODES.SUCCESS);
|
|
77
|
-
} catch (e) {
|
|
78
|
-
process.stderr.write(JSON.stringify({
|
|
79
|
-
success: false,
|
|
80
|
-
error: `Connection test failed: ${e instanceof Error ? e.message : String(e)}`
|
|
81
|
-
}, null, 2) + "\n");
|
|
82
|
-
process.exit(CONFIGURE_AI_EXIT_CODES.VALIDATION_FAIL);
|
|
83
|
-
}
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (!args.provider && !args.model && !args.apiKey && !args.endpoint) {
|
|
87
|
-
process.stderr.write(JSON.stringify({
|
|
88
|
-
error: "Provide at least one of: --provider, --model, --api-key, --endpoint",
|
|
89
|
-
usage: "neuroverse configure-ai --provider openai --model gpt-4.1-mini --api-key sk-..."
|
|
90
|
-
}, null, 2) + "\n");
|
|
91
|
-
process.exit(CONFIGURE_AI_EXIT_CODES.VALIDATION_FAIL);
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
const existing = await loadConfig();
|
|
95
|
-
const config = {
|
|
96
|
-
provider: args.provider ?? existing?.provider ?? "openai",
|
|
97
|
-
model: args.model ?? existing?.model ?? "",
|
|
98
|
-
apiKey: args.apiKey ?? existing?.apiKey ?? "",
|
|
99
|
-
endpoint: args.endpoint ?? existing?.endpoint ?? null
|
|
100
|
-
};
|
|
101
|
-
if (!config.model) {
|
|
102
|
-
process.stderr.write(JSON.stringify({
|
|
103
|
-
error: "Model is required. Use --model <name>"
|
|
104
|
-
}, null, 2) + "\n");
|
|
105
|
-
process.exit(CONFIGURE_AI_EXIT_CODES.VALIDATION_FAIL);
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
if (!config.apiKey) {
|
|
109
|
-
process.stderr.write(JSON.stringify({
|
|
110
|
-
error: "API key is required. Use --api-key <key>"
|
|
111
|
-
}, null, 2) + "\n");
|
|
112
|
-
process.exit(CONFIGURE_AI_EXIT_CODES.VALIDATION_FAIL);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
await saveConfig(config);
|
|
116
|
-
process.stdout.write(JSON.stringify({
|
|
117
|
-
success: true,
|
|
118
|
-
configPath: getConfigPath(),
|
|
119
|
-
...redactConfig(config)
|
|
120
|
-
}, null, 2) + "\n");
|
|
121
|
-
process.exit(CONFIGURE_AI_EXIT_CODES.SUCCESS);
|
|
122
|
-
} catch (e) {
|
|
123
|
-
process.stderr.write(JSON.stringify({
|
|
124
|
-
error: "Configuration failed",
|
|
125
|
-
detail: e instanceof Error ? e.message : String(e)
|
|
126
|
-
}, null, 2) + "\n");
|
|
127
|
-
process.exit(CONFIGURE_AI_EXIT_CODES.ERROR);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
export {
|
|
131
|
-
main
|
|
132
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
readAuditLog
|
|
3
|
-
} from "./chunk-REXY4LUL.js";
|
|
4
|
-
import {
|
|
5
|
-
generateDecisionFlow,
|
|
6
|
-
renderDecisionFlow
|
|
7
|
-
} from "./chunk-D2UCV5AK.js";
|
|
8
|
-
import "./chunk-IZSO75NZ.js";
|
|
9
|
-
import "./chunk-QLPTHTVB.js";
|
|
10
|
-
import "./chunk-YZFATT7X.js";
|
|
11
|
-
|
|
12
|
-
// src/cli/decision-flow.ts
|
|
13
|
-
async function main(args) {
|
|
14
|
-
let logPath = ".neuroverse/audit.ndjson";
|
|
15
|
-
let jsonOutput = false;
|
|
16
|
-
for (let i = 0; i < args.length; i++) {
|
|
17
|
-
if (args[i] === "--log" && args[i + 1]) {
|
|
18
|
-
logPath = args[++i];
|
|
19
|
-
}
|
|
20
|
-
if (args[i] === "--json") {
|
|
21
|
-
jsonOutput = true;
|
|
22
|
-
}
|
|
23
|
-
if (args[i] === "--help" || args[i] === "-h") {
|
|
24
|
-
process.stdout.write(`
|
|
25
|
-
neuroverse decision-flow \u2014 Visualize Intent \u2192 Rule \u2192 Outcome
|
|
26
|
-
|
|
27
|
-
Usage:
|
|
28
|
-
neuroverse decision-flow [--log <path>] [--json]
|
|
29
|
-
|
|
30
|
-
Options:
|
|
31
|
-
--log <path> Path to audit log (default: .neuroverse/audit.ndjson)
|
|
32
|
-
--json Output as JSON instead of text
|
|
33
|
-
|
|
34
|
-
Shows:
|
|
35
|
-
- What agents WANTED to do (Intent Pool)
|
|
36
|
-
- What rules INTERCEPTED (Rule Obstacles)
|
|
37
|
-
- What actually HAPPENED (Outcome Pool)
|
|
38
|
-
- Behavioral economy (penalties vs rewards)
|
|
39
|
-
|
|
40
|
-
Headline metric: "X% of agent intent was redirected by governance"
|
|
41
|
-
`.trim() + "\n");
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const events = await readAuditLog(logPath);
|
|
46
|
-
if (events.length === 0) {
|
|
47
|
-
process.stderr.write("No audit events found. Run governed actions first.\n");
|
|
48
|
-
process.stderr.write(`Looking in: ${logPath}
|
|
49
|
-
`);
|
|
50
|
-
process.exit(1);
|
|
51
|
-
}
|
|
52
|
-
const flow = generateDecisionFlow(events);
|
|
53
|
-
if (jsonOutput) {
|
|
54
|
-
process.stdout.write(JSON.stringify(flow, null, 2) + "\n");
|
|
55
|
-
} else {
|
|
56
|
-
process.stdout.write(renderDecisionFlow(flow) + "\n");
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
export {
|
|
60
|
-
main
|
|
61
|
-
};
|
package/dist/derive-7365SUFU.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DeriveInputError,
|
|
3
|
-
DeriveProviderError,
|
|
4
|
-
deriveWorld
|
|
5
|
-
} from "./chunk-ORJ3NOE6.js";
|
|
6
|
-
import {
|
|
7
|
-
DERIVE_EXIT_CODES
|
|
8
|
-
} from "./chunk-Q6O7ZLO2.js";
|
|
9
|
-
import "./chunk-XPDMYECO.js";
|
|
10
|
-
import "./chunk-OT6PXH54.js";
|
|
11
|
-
import "./chunk-7P3S7MAY.js";
|
|
12
|
-
import "./chunk-YZFATT7X.js";
|
|
13
|
-
|
|
14
|
-
// src/cli/derive.ts
|
|
15
|
-
function parseArgs(argv) {
|
|
16
|
-
let inputPath = "";
|
|
17
|
-
let outputPath = "./derived.nv-world.md";
|
|
18
|
-
let validate = true;
|
|
19
|
-
let dryRun = false;
|
|
20
|
-
let bootstrapDir;
|
|
21
|
-
let provider;
|
|
22
|
-
let model;
|
|
23
|
-
let endpoint;
|
|
24
|
-
for (let i = 0; i < argv.length; i++) {
|
|
25
|
-
const arg = argv[i];
|
|
26
|
-
if (arg === "--input" && i + 1 < argv.length) {
|
|
27
|
-
inputPath = argv[++i];
|
|
28
|
-
} else if (arg === "--output" && i + 1 < argv.length) {
|
|
29
|
-
outputPath = argv[++i];
|
|
30
|
-
} else if (arg === "--validate") {
|
|
31
|
-
validate = true;
|
|
32
|
-
} else if (arg === "--no-validate") {
|
|
33
|
-
validate = false;
|
|
34
|
-
} else if (arg === "--dry-run") {
|
|
35
|
-
dryRun = true;
|
|
36
|
-
} else if (arg === "--bootstrap" && i + 1 < argv.length) {
|
|
37
|
-
bootstrapDir = argv[++i];
|
|
38
|
-
} else if (arg === "--provider" && i + 1 < argv.length) {
|
|
39
|
-
provider = argv[++i];
|
|
40
|
-
} else if (arg === "--model" && i + 1 < argv.length) {
|
|
41
|
-
model = argv[++i];
|
|
42
|
-
} else if (arg === "--endpoint" && i + 1 < argv.length) {
|
|
43
|
-
endpoint = argv[++i];
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (!inputPath) throw new DeriveInputError("--input <path> is required");
|
|
47
|
-
return { inputPath, outputPath, validate, dryRun, bootstrapDir, provider, model, endpoint };
|
|
48
|
-
}
|
|
49
|
-
async function main(argv = process.argv.slice(2)) {
|
|
50
|
-
try {
|
|
51
|
-
const args = parseArgs(argv);
|
|
52
|
-
const { result, exitCode, dryRunOutput } = await deriveWorld({
|
|
53
|
-
inputPath: args.inputPath,
|
|
54
|
-
outputPath: args.outputPath,
|
|
55
|
-
validate: args.validate,
|
|
56
|
-
dryRun: args.dryRun,
|
|
57
|
-
providerOverride: args.provider || args.model || args.endpoint ? {
|
|
58
|
-
provider: args.provider,
|
|
59
|
-
model: args.model,
|
|
60
|
-
endpoint: args.endpoint
|
|
61
|
-
} : void 0
|
|
62
|
-
});
|
|
63
|
-
if (dryRunOutput) {
|
|
64
|
-
process.stdout.write(JSON.stringify({
|
|
65
|
-
dryRun: true,
|
|
66
|
-
systemPrompt: dryRunOutput.systemPrompt,
|
|
67
|
-
userPrompt: dryRunOutput.userPrompt,
|
|
68
|
-
durationMs: result.durationMs
|
|
69
|
-
}, null, 2) + "\n");
|
|
70
|
-
process.exit(DERIVE_EXIT_CODES.SUCCESS);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
process.stderr.write(`
|
|
74
|
-
Derived world written to: ${result.outputPath}
|
|
75
|
-
`);
|
|
76
|
-
process.stderr.write(`Derivation Gate: ${result.gate}
|
|
77
|
-
`);
|
|
78
|
-
if (result.normalization) {
|
|
79
|
-
const n = result.normalization;
|
|
80
|
-
const details = [];
|
|
81
|
-
if (n.invariantIds > 0) details.push(`${n.invariantIds} invariant ID(s) wrapped`);
|
|
82
|
-
if (n.gateThresholds > 0) details.push(`${n.gateThresholds} gate threshold(s) converted`);
|
|
83
|
-
if (n.triggerTags > 0) details.push(`${n.triggerTags} trigger(s) tagged with [state]`);
|
|
84
|
-
process.stderr.write(`
|
|
85
|
-
Normalization: ${n.fixCount} fix(es) applied
|
|
86
|
-
`);
|
|
87
|
-
for (const d of details) process.stderr.write(` - ${d}
|
|
88
|
-
`);
|
|
89
|
-
}
|
|
90
|
-
if (result.findings.length > 0) {
|
|
91
|
-
process.stderr.write(`
|
|
92
|
-
`);
|
|
93
|
-
const errs = result.findings.filter((f) => f.severity === "error");
|
|
94
|
-
const warns = result.findings.filter((f) => f.severity === "warning");
|
|
95
|
-
if (errs.length > 0) {
|
|
96
|
-
process.stderr.write(`Errors (${errs.length}):
|
|
97
|
-
`);
|
|
98
|
-
for (const f of errs) {
|
|
99
|
-
process.stderr.write(` ERROR [${f.section}]: ${f.message}
|
|
100
|
-
`);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (warns.length > 0) {
|
|
104
|
-
process.stderr.write(`Warnings (${warns.length}):
|
|
105
|
-
`);
|
|
106
|
-
for (const f of warns) {
|
|
107
|
-
process.stderr.write(` WARN [${f.section}]: ${f.message}
|
|
108
|
-
`);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
process.stderr.write(`
|
|
112
|
-
`);
|
|
113
|
-
}
|
|
114
|
-
if (result.gate === "SUSPECT" || result.gate === "DERIVATION_REJECTED") {
|
|
115
|
-
process.stderr.write(`The file has been written. Open ${result.outputPath} to review and fix.
|
|
116
|
-
`);
|
|
117
|
-
}
|
|
118
|
-
if (args.bootstrapDir && exitCode === 0) {
|
|
119
|
-
process.stderr.write(`
|
|
120
|
-
Bootstrapping to ${args.bootstrapDir}...
|
|
121
|
-
`);
|
|
122
|
-
const { main: bootstrapMain } = await import("./bootstrap-GXVDZNF7.js");
|
|
123
|
-
await bootstrapMain([
|
|
124
|
-
"--input",
|
|
125
|
-
result.outputPath,
|
|
126
|
-
"--output",
|
|
127
|
-
args.bootstrapDir,
|
|
128
|
-
...args.validate ? ["--validate"] : []
|
|
129
|
-
]);
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
133
|
-
process.exit(exitCode);
|
|
134
|
-
} catch (e) {
|
|
135
|
-
if (e instanceof DeriveInputError) {
|
|
136
|
-
process.stderr.write(JSON.stringify({ error: e.message }, null, 2) + "\n");
|
|
137
|
-
process.exit(DERIVE_EXIT_CODES.INPUT_ERROR);
|
|
138
|
-
} else if (e instanceof DeriveProviderError) {
|
|
139
|
-
process.stderr.write(JSON.stringify({ error: e.message }, null, 2) + "\n");
|
|
140
|
-
process.exit(DERIVE_EXIT_CODES.PROVIDER_ERROR);
|
|
141
|
-
} else {
|
|
142
|
-
process.stderr.write(JSON.stringify({
|
|
143
|
-
error: "Derive failed",
|
|
144
|
-
detail: e instanceof Error ? e.message : String(e)
|
|
145
|
-
}, null, 2) + "\n");
|
|
146
|
-
process.exit(DERIVE_EXIT_CODES.PROVIDER_ERROR);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
export {
|
|
151
|
-
main
|
|
152
|
-
};
|
package/dist/doctor-QYISMKEL.js
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
loadConfig
|
|
3
|
-
} from "./chunk-OT6PXH54.js";
|
|
4
|
-
import {
|
|
5
|
-
__glob
|
|
6
|
-
} from "./chunk-YZFATT7X.js";
|
|
7
|
-
|
|
8
|
-
// import("../adapters/**/*") in src/cli/doctor.ts
|
|
9
|
-
var globImport_adapters = __glob({
|
|
10
|
-
"../adapters/autoresearch.ts": () => import("./adapters/autoresearch.js"),
|
|
11
|
-
"../adapters/deep-agents.ts": () => import("./adapters/deep-agents.js"),
|
|
12
|
-
"../adapters/express.ts": () => import("./adapters/express.js"),
|
|
13
|
-
"../adapters/index.ts": () => import("./adapters/index.js"),
|
|
14
|
-
"../adapters/langchain.ts": () => import("./adapters/langchain.js"),
|
|
15
|
-
"../adapters/openai.ts": () => import("./adapters/openai.js"),
|
|
16
|
-
"../adapters/openclaw.ts": () => import("./adapters/openclaw.js"),
|
|
17
|
-
"../adapters/shared.ts": () => import("./shared-U2QFV7JH.js")
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
// src/cli/doctor.ts
|
|
21
|
-
var PACKAGE_VERSION = "0.2.0";
|
|
22
|
-
var MIN_NODE_VERSION = 18;
|
|
23
|
-
async function main(argv) {
|
|
24
|
-
const json = argv.includes("--json");
|
|
25
|
-
let worldPath;
|
|
26
|
-
for (let i = 0; i < argv.length; i++) {
|
|
27
|
-
if (argv[i] === "--world" && i + 1 < argv.length) {
|
|
28
|
-
worldPath = argv[++i];
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
const checks = [];
|
|
32
|
-
const nodeVersion = process.version;
|
|
33
|
-
const major = parseInt(nodeVersion.slice(1), 10);
|
|
34
|
-
checks.push({
|
|
35
|
-
label: "Node version",
|
|
36
|
-
status: major >= MIN_NODE_VERSION ? "pass" : "fail",
|
|
37
|
-
value: nodeVersion,
|
|
38
|
-
detail: major < MIN_NODE_VERSION ? `Requires Node >= ${MIN_NODE_VERSION}` : void 0
|
|
39
|
-
});
|
|
40
|
-
checks.push({
|
|
41
|
-
label: "NeuroVerse version",
|
|
42
|
-
status: "pass",
|
|
43
|
-
value: PACKAGE_VERSION
|
|
44
|
-
});
|
|
45
|
-
try {
|
|
46
|
-
const config = await loadConfig();
|
|
47
|
-
if (config?.provider && config?.apiKey) {
|
|
48
|
-
checks.push({
|
|
49
|
-
label: "AI provider configured",
|
|
50
|
-
status: "pass",
|
|
51
|
-
value: `${config.provider}${config.model ? ` (${config.model})` : ""}`
|
|
52
|
-
});
|
|
53
|
-
} else {
|
|
54
|
-
checks.push({
|
|
55
|
-
label: "AI provider configured",
|
|
56
|
-
status: "warn",
|
|
57
|
-
value: "not configured",
|
|
58
|
-
detail: "Run: neuroverse configure-ai --provider openai --model gpt-4.1-mini --api-key <key>"
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
} catch {
|
|
62
|
-
checks.push({
|
|
63
|
-
label: "AI provider configured",
|
|
64
|
-
status: "warn",
|
|
65
|
-
value: "not configured",
|
|
66
|
-
detail: "Run: neuroverse configure-ai"
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
if (worldPath) {
|
|
70
|
-
try {
|
|
71
|
-
const { existsSync } = await import("fs");
|
|
72
|
-
const { join } = await import("path");
|
|
73
|
-
const hasWorld = existsSync(join(worldPath, "world.json"));
|
|
74
|
-
checks.push({
|
|
75
|
-
label: "World file detected",
|
|
76
|
-
status: hasWorld ? "pass" : "fail",
|
|
77
|
-
value: hasWorld ? worldPath : "not found",
|
|
78
|
-
detail: hasWorld ? void 0 : `No world.json found in ${worldPath}`
|
|
79
|
-
});
|
|
80
|
-
} catch {
|
|
81
|
-
checks.push({
|
|
82
|
-
label: "World file detected",
|
|
83
|
-
status: "fail",
|
|
84
|
-
value: "error reading path"
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
} else {
|
|
88
|
-
const { existsSync } = await import("fs");
|
|
89
|
-
const { join } = await import("path");
|
|
90
|
-
const candidates = ["./world", "./.neuroverse", "./worlds"];
|
|
91
|
-
let found;
|
|
92
|
-
for (const dir of candidates) {
|
|
93
|
-
if (existsSync(join(dir, "world.json"))) {
|
|
94
|
-
found = dir;
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
checks.push({
|
|
99
|
-
label: "World file detected",
|
|
100
|
-
status: found ? "pass" : "warn",
|
|
101
|
-
value: found ?? "none found",
|
|
102
|
-
detail: found ? void 0 : "Build a world: neuroverse build <input.md>"
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
try {
|
|
106
|
-
const { evaluateGuard } = await import("./guard-engine-QFMIBWJY.js");
|
|
107
|
-
checks.push({
|
|
108
|
-
label: "Guard engine",
|
|
109
|
-
status: typeof evaluateGuard === "function" ? "pass" : "fail",
|
|
110
|
-
value: "loaded"
|
|
111
|
-
});
|
|
112
|
-
} catch {
|
|
113
|
-
checks.push({ label: "Guard engine", status: "fail", value: "failed to load" });
|
|
114
|
-
}
|
|
115
|
-
try {
|
|
116
|
-
const { validateWorld } = await import("./validate-engine-UIABSIHD.js");
|
|
117
|
-
checks.push({
|
|
118
|
-
label: "Validation engine",
|
|
119
|
-
status: typeof validateWorld === "function" ? "pass" : "fail",
|
|
120
|
-
value: "loaded"
|
|
121
|
-
});
|
|
122
|
-
} catch {
|
|
123
|
-
checks.push({ label: "Validation engine", status: "fail", value: "failed to load" });
|
|
124
|
-
}
|
|
125
|
-
const adapterNames = ["openai", "express", "langchain", "openclaw"];
|
|
126
|
-
const loadedAdapters = [];
|
|
127
|
-
for (const name of adapterNames) {
|
|
128
|
-
try {
|
|
129
|
-
await globImport_adapters(`../adapters/${name}`);
|
|
130
|
-
loadedAdapters.push(name);
|
|
131
|
-
} catch {
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
checks.push({
|
|
135
|
-
label: "Adapters",
|
|
136
|
-
status: loadedAdapters.length > 0 ? "pass" : "warn",
|
|
137
|
-
value: loadedAdapters.length > 0 ? loadedAdapters.join(", ") : "none"
|
|
138
|
-
});
|
|
139
|
-
if (json) {
|
|
140
|
-
const hasFailure2 = checks.some((c) => c.status === "fail");
|
|
141
|
-
process.stdout.write(JSON.stringify({
|
|
142
|
-
status: hasFailure2 ? "fail" : "pass",
|
|
143
|
-
checks
|
|
144
|
-
}, null, 2) + "\n");
|
|
145
|
-
process.exit(hasFailure2 ? 1 : 0);
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
process.stderr.write("\nNeuroVerse Environment Check\n");
|
|
149
|
-
process.stderr.write("\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\n");
|
|
150
|
-
const maxLabel = Math.max(...checks.map((c) => c.label.length));
|
|
151
|
-
for (const check of checks) {
|
|
152
|
-
const icon = check.status === "pass" ? "ok" : check.status === "warn" ? "!!" : "FAIL";
|
|
153
|
-
const pad = " ".repeat(maxLabel - check.label.length);
|
|
154
|
-
process.stderr.write(` ${check.label}${pad} ${icon} ${check.value}
|
|
155
|
-
`);
|
|
156
|
-
if (check.detail) {
|
|
157
|
-
process.stderr.write(` ${" ".repeat(maxLabel)} ${check.detail}
|
|
158
|
-
`);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
const hasFailure = checks.some((c) => c.status === "fail");
|
|
162
|
-
process.stderr.write("\n");
|
|
163
|
-
if (hasFailure) {
|
|
164
|
-
process.stderr.write("Some checks failed. Fix the issues above and re-run.\n");
|
|
165
|
-
} else {
|
|
166
|
-
process.stderr.write("System ready.\n");
|
|
167
|
-
}
|
|
168
|
-
process.stderr.write("\n");
|
|
169
|
-
process.exit(hasFailure ? 1 : 0);
|
|
170
|
-
}
|
|
171
|
-
export {
|
|
172
|
-
main
|
|
173
|
-
};
|