@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,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-EKTRSR7C.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-EKTRSR7C.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,152 +0,0 @@
1
- import {
2
- DeriveInputError,
3
- DeriveProviderError,
4
- deriveWorld
5
- } from "./chunk-NF5POFCI.js";
6
- import {
7
- DERIVE_EXIT_CODES
8
- } from "./chunk-Q6O7ZLO2.js";
9
- import "./chunk-OT6PXH54.js";
10
- import "./chunk-XPDMYECO.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
- };
@@ -1,171 +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/express.ts": () => import("./adapters/express.js"),
12
- "../adapters/index.ts": () => import("./adapters/index.js"),
13
- "../adapters/langchain.ts": () => import("./adapters/langchain.js"),
14
- "../adapters/openai.ts": () => import("./adapters/openai.js"),
15
- "../adapters/openclaw.ts": () => import("./adapters/openclaw.js")
16
- });
17
-
18
- // src/cli/doctor.ts
19
- var PACKAGE_VERSION = "0.2.0";
20
- var MIN_NODE_VERSION = 18;
21
- async function main(argv) {
22
- const json = argv.includes("--json");
23
- let worldPath;
24
- for (let i = 0; i < argv.length; i++) {
25
- if (argv[i] === "--world" && i + 1 < argv.length) {
26
- worldPath = argv[++i];
27
- }
28
- }
29
- const checks = [];
30
- const nodeVersion = process.version;
31
- const major = parseInt(nodeVersion.slice(1), 10);
32
- checks.push({
33
- label: "Node version",
34
- status: major >= MIN_NODE_VERSION ? "pass" : "fail",
35
- value: nodeVersion,
36
- detail: major < MIN_NODE_VERSION ? `Requires Node >= ${MIN_NODE_VERSION}` : void 0
37
- });
38
- checks.push({
39
- label: "NeuroVerse version",
40
- status: "pass",
41
- value: PACKAGE_VERSION
42
- });
43
- try {
44
- const config = await loadConfig();
45
- if (config?.provider && config?.apiKey) {
46
- checks.push({
47
- label: "AI provider configured",
48
- status: "pass",
49
- value: `${config.provider}${config.model ? ` (${config.model})` : ""}`
50
- });
51
- } else {
52
- checks.push({
53
- label: "AI provider configured",
54
- status: "warn",
55
- value: "not configured",
56
- detail: "Run: neuroverse configure-ai --provider openai --model gpt-4.1-mini --api-key <key>"
57
- });
58
- }
59
- } catch {
60
- checks.push({
61
- label: "AI provider configured",
62
- status: "warn",
63
- value: "not configured",
64
- detail: "Run: neuroverse configure-ai"
65
- });
66
- }
67
- if (worldPath) {
68
- try {
69
- const { existsSync } = await import("fs");
70
- const { join } = await import("path");
71
- const hasWorld = existsSync(join(worldPath, "world.json"));
72
- checks.push({
73
- label: "World file detected",
74
- status: hasWorld ? "pass" : "fail",
75
- value: hasWorld ? worldPath : "not found",
76
- detail: hasWorld ? void 0 : `No world.json found in ${worldPath}`
77
- });
78
- } catch {
79
- checks.push({
80
- label: "World file detected",
81
- status: "fail",
82
- value: "error reading path"
83
- });
84
- }
85
- } else {
86
- const { existsSync } = await import("fs");
87
- const { join } = await import("path");
88
- const candidates = ["./world", "./.neuroverse", "./worlds"];
89
- let found;
90
- for (const dir of candidates) {
91
- if (existsSync(join(dir, "world.json"))) {
92
- found = dir;
93
- break;
94
- }
95
- }
96
- checks.push({
97
- label: "World file detected",
98
- status: found ? "pass" : "warn",
99
- value: found ?? "none found",
100
- detail: found ? void 0 : "Build a world: neuroverse build <input.md>"
101
- });
102
- }
103
- try {
104
- const { evaluateGuard } = await import("./guard-engine-JLTUARGU.js");
105
- checks.push({
106
- label: "Guard engine",
107
- status: typeof evaluateGuard === "function" ? "pass" : "fail",
108
- value: "loaded"
109
- });
110
- } catch {
111
- checks.push({ label: "Guard engine", status: "fail", value: "failed to load" });
112
- }
113
- try {
114
- const { validateWorld } = await import("./validate-engine-UIABSIHD.js");
115
- checks.push({
116
- label: "Validation engine",
117
- status: typeof validateWorld === "function" ? "pass" : "fail",
118
- value: "loaded"
119
- });
120
- } catch {
121
- checks.push({ label: "Validation engine", status: "fail", value: "failed to load" });
122
- }
123
- const adapterNames = ["openai", "express", "langchain", "openclaw"];
124
- const loadedAdapters = [];
125
- for (const name of adapterNames) {
126
- try {
127
- await globImport_adapters(`../adapters/${name}`);
128
- loadedAdapters.push(name);
129
- } catch {
130
- }
131
- }
132
- checks.push({
133
- label: "Adapters",
134
- status: loadedAdapters.length > 0 ? "pass" : "warn",
135
- value: loadedAdapters.length > 0 ? loadedAdapters.join(", ") : "none"
136
- });
137
- if (json) {
138
- const hasFailure2 = checks.some((c) => c.status === "fail");
139
- process.stdout.write(JSON.stringify({
140
- status: hasFailure2 ? "fail" : "pass",
141
- checks
142
- }, null, 2) + "\n");
143
- process.exit(hasFailure2 ? 1 : 0);
144
- return;
145
- }
146
- process.stderr.write("\nNeuroVerse Environment Check\n");
147
- 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");
148
- const maxLabel = Math.max(...checks.map((c) => c.label.length));
149
- for (const check of checks) {
150
- const icon = check.status === "pass" ? "ok" : check.status === "warn" ? "!!" : "FAIL";
151
- const pad = " ".repeat(maxLabel - check.label.length);
152
- process.stderr.write(` ${check.label}${pad} ${icon} ${check.value}
153
- `);
154
- if (check.detail) {
155
- process.stderr.write(` ${" ".repeat(maxLabel)} ${check.detail}
156
- `);
157
- }
158
- }
159
- const hasFailure = checks.some((c) => c.status === "fail");
160
- process.stderr.write("\n");
161
- if (hasFailure) {
162
- process.stderr.write("Some checks failed. Fix the issues above and re-run.\n");
163
- } else {
164
- process.stderr.write("System ready.\n");
165
- }
166
- process.stderr.write("\n");
167
- process.exit(hasFailure ? 1 : 0);
168
- }
169
- export {
170
- main
171
- };