@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,20 @@
|
|
|
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 };
|
|
@@ -0,0 +1,20 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import {
|
|
2
|
+
describeActiveWorld,
|
|
3
|
+
resolveWorldPath
|
|
4
|
+
} from "../chunk-AKW5YVCE.js";
|
|
5
|
+
import "../chunk-QWGCMQQD.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-VXEKB4LS.js");
|
|
95
|
+
const { runInteractiveMode } = await import("../session-JYOARW54.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-JYOARW54.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
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
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-QWGCMQQD.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
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
readAuditLog
|
|
3
|
+
} from "./chunk-A7GKPPU7.js";
|
|
4
|
+
import {
|
|
5
|
+
generateDecisionFlow,
|
|
6
|
+
renderDecisionFlow
|
|
7
|
+
} from "./chunk-D2UCV5AK.js";
|
|
8
|
+
import "./chunk-W7LLXRGY.js";
|
|
9
|
+
import "./chunk-QLPTHTVB.js";
|
|
10
|
+
import "./chunk-QWGCMQQD.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
|
+
};
|