@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.
Files changed (118) hide show
  1. package/package.json +4 -2
  2. package/policies/content-moderation-rules.txt +8 -0
  3. package/policies/marketing-rules.txt +8 -0
  4. package/policies/science-research-rules.txt +11 -0
  5. package/policies/social-media-rules.txt +7 -0
  6. package/policies/strict-rules.txt +8 -0
  7. package/policies/trading-rules.txt +8 -0
  8. package/simulate.html +1899 -0
  9. package/dist/adapters/autoresearch.cjs +0 -196
  10. package/dist/adapters/autoresearch.d.cts +0 -103
  11. package/dist/adapters/autoresearch.d.ts +0 -103
  12. package/dist/adapters/autoresearch.js +0 -7
  13. package/dist/adapters/deep-agents.cjs +0 -1472
  14. package/dist/adapters/deep-agents.d.cts +0 -181
  15. package/dist/adapters/deep-agents.d.ts +0 -181
  16. package/dist/adapters/deep-agents.js +0 -17
  17. package/dist/adapters/express.cjs +0 -1196
  18. package/dist/adapters/express.d.cts +0 -66
  19. package/dist/adapters/express.d.ts +0 -66
  20. package/dist/adapters/express.js +0 -12
  21. package/dist/adapters/index.cjs +0 -2038
  22. package/dist/adapters/index.d.cts +0 -8
  23. package/dist/adapters/index.d.ts +0 -8
  24. package/dist/adapters/index.js +0 -68
  25. package/dist/adapters/langchain.cjs +0 -1259
  26. package/dist/adapters/langchain.d.cts +0 -89
  27. package/dist/adapters/langchain.d.ts +0 -89
  28. package/dist/adapters/langchain.js +0 -17
  29. package/dist/adapters/openai.cjs +0 -1289
  30. package/dist/adapters/openai.d.cts +0 -99
  31. package/dist/adapters/openai.d.ts +0 -99
  32. package/dist/adapters/openai.js +0 -17
  33. package/dist/adapters/openclaw.cjs +0 -1281
  34. package/dist/adapters/openclaw.d.cts +0 -99
  35. package/dist/adapters/openclaw.d.ts +0 -99
  36. package/dist/adapters/openclaw.js +0 -17
  37. package/dist/bootstrap-GXVDZNF7.js +0 -114
  38. package/dist/build-X5MZY4IA.js +0 -339
  39. package/dist/chunk-4L6OPKMQ.js +0 -100
  40. package/dist/chunk-4NGDRRQH.js +0 -10
  41. package/dist/chunk-5U2MQO5P.js +0 -57
  42. package/dist/chunk-6BB55YJI.js +0 -113
  43. package/dist/chunk-6CZSKEY5.js +0 -164
  44. package/dist/chunk-7P3S7MAY.js +0 -1090
  45. package/dist/chunk-A5W4GNQO.js +0 -130
  46. package/dist/chunk-AF2VX4AL.js +0 -363
  47. package/dist/chunk-AKW5YVCE.js +0 -96
  48. package/dist/chunk-BMOXICAB.js +0 -340
  49. package/dist/chunk-BQZMOEML.js +0 -43
  50. package/dist/chunk-D2UCV5AK.js +0 -326
  51. package/dist/chunk-EVDJUSZ2.js +0 -91
  52. package/dist/chunk-FYS2CBUW.js +0 -304
  53. package/dist/chunk-I3RRAYK2.js +0 -11
  54. package/dist/chunk-IZSO75NZ.js +0 -792
  55. package/dist/chunk-JCKSW2PZ.js +0 -304
  56. package/dist/chunk-JZPQGIKR.js +0 -79
  57. package/dist/chunk-KTFTTLTP.js +0 -246
  58. package/dist/chunk-MH7BT4VH.js +0 -15
  59. package/dist/chunk-ORJ3NOE6.js +0 -622
  60. package/dist/chunk-OT6PXH54.js +0 -61
  61. package/dist/chunk-Q6O7ZLO2.js +0 -62
  62. package/dist/chunk-QLPTHTVB.js +0 -253
  63. package/dist/chunk-REXY4LUL.js +0 -226
  64. package/dist/chunk-T5EUJQE5.js +0 -172
  65. package/dist/chunk-TTBKTF3P.js +0 -608
  66. package/dist/chunk-XPDMYECO.js +0 -642
  67. package/dist/chunk-YZFATT7X.js +0 -9
  68. package/dist/chunk-ZIVQNSZU.js +0 -119
  69. package/dist/chunk-ZJTDUCC2.js +0 -194
  70. package/dist/cli/neuroverse.cjs +0 -12564
  71. package/dist/cli/neuroverse.d.cts +0 -1
  72. package/dist/cli/neuroverse.d.ts +0 -1
  73. package/dist/cli/neuroverse.js +0 -208
  74. package/dist/cli/plan.cjs +0 -1686
  75. package/dist/cli/plan.d.cts +0 -20
  76. package/dist/cli/plan.d.ts +0 -20
  77. package/dist/cli/plan.js +0 -353
  78. package/dist/cli/run.cjs +0 -1945
  79. package/dist/cli/run.d.cts +0 -20
  80. package/dist/cli/run.d.ts +0 -20
  81. package/dist/cli/run.js +0 -143
  82. package/dist/configure-ai-TK67ZWZL.js +0 -132
  83. package/dist/decision-flow-LETV5NWY.js +0 -61
  84. package/dist/derive-7365SUFU.js +0 -152
  85. package/dist/doctor-QYISMKEL.js +0 -173
  86. package/dist/equity-penalties-63FGB3I2.js +0 -244
  87. package/dist/explain-A2EWI2OL.js +0 -51
  88. package/dist/guard-3BWL3IGH.js +0 -92
  89. package/dist/guard-contract-C9_zKbzd.d.cts +0 -821
  90. package/dist/guard-contract-C9_zKbzd.d.ts +0 -821
  91. package/dist/guard-engine-QFMIBWJY.js +0 -10
  92. package/dist/impact-UB6DXKSX.js +0 -59
  93. package/dist/improve-XZA57GER.js +0 -66
  94. package/dist/index.cjs +0 -6821
  95. package/dist/index.d.cts +0 -1829
  96. package/dist/index.d.ts +0 -1829
  97. package/dist/index.js +0 -430
  98. package/dist/infer-world-7GVZWFX4.js +0 -543
  99. package/dist/init-PKPIYHYE.js +0 -144
  100. package/dist/init-world-VWMQZQC7.js +0 -223
  101. package/dist/mcp-server-XWQZXNW7.js +0 -13
  102. package/dist/model-adapter-BB7G4MFI.js +0 -11
  103. package/dist/playground-ADWZORNV.js +0 -550
  104. package/dist/redteam-JRQ7FD2F.js +0 -357
  105. package/dist/session-MMYX5YCF.js +0 -15
  106. package/dist/shared--Q8wPBVN.d.ts +0 -60
  107. package/dist/shared-HpAG90PX.d.cts +0 -60
  108. package/dist/shared-U2QFV7JH.js +0 -16
  109. package/dist/simulate-GMIFFXYV.js +0 -83
  110. package/dist/test-JBBZ65X4.js +0 -217
  111. package/dist/trace-3MYWIDEF.js +0 -166
  112. package/dist/validate-LLBWVPGV.js +0 -81
  113. package/dist/validate-engine-UIABSIHD.js +0 -7
  114. package/dist/world-BFJCIQSH.js +0 -378
  115. package/dist/world-loader-HMPTOEA2.js +0 -9
  116. package/dist/worlds/autoresearch.nv-world.md +0 -230
  117. package/dist/worlds/coding-agent.nv-world.md +0 -211
  118. package/dist/worlds/derivation-world.nv-world.md +0 -278
@@ -1,20 +0,0 @@
1
- /**
2
- * neuroverse plan — Plan Enforcement CLI
3
- *
4
- * Subcommands:
5
- * compile Parse plan markdown into plan.json
6
- * check Check an action against a plan (stdin → stdout)
7
- * status Show plan progress
8
- * advance Mark a step as completed
9
- * derive Generate a full world from a plan
10
- *
11
- * Usage:
12
- * neuroverse plan compile <plan.md> [--output plan.json]
13
- * echo '{"intent":"..."}' | neuroverse plan check --plan plan.json [--world ./world/]
14
- * neuroverse plan status --plan plan.json
15
- * neuroverse plan advance <step_id> --plan plan.json
16
- * neuroverse plan derive <plan.md> [--output ./world/]
17
- */
18
- declare function main(args: string[]): Promise<void>;
19
-
20
- export { main };
@@ -1,20 +0,0 @@
1
- /**
2
- * neuroverse plan — Plan Enforcement CLI
3
- *
4
- * Subcommands:
5
- * compile Parse plan markdown into plan.json
6
- * check Check an action against a plan (stdin → stdout)
7
- * status Show plan progress
8
- * advance Mark a step as completed
9
- * derive Generate a full world from a plan
10
- *
11
- * Usage:
12
- * neuroverse plan compile <plan.md> [--output plan.json]
13
- * echo '{"intent":"..."}' | neuroverse plan check --plan plan.json [--world ./world/]
14
- * neuroverse plan status --plan plan.json
15
- * neuroverse plan advance <step_id> --plan plan.json
16
- * neuroverse plan derive <plan.md> [--output ./world/]
17
- */
18
- declare function main(args: string[]): Promise<void>;
19
-
20
- export { main };
package/dist/cli/plan.js DELETED
@@ -1,353 +0,0 @@
1
- import {
2
- readStdin
3
- } from "../chunk-BQZMOEML.js";
4
- import {
5
- PLAN_EXIT_CODES,
6
- parsePlanMarkdown
7
- } from "../chunk-6CZSKEY5.js";
8
- import {
9
- advancePlan,
10
- evaluatePlan,
11
- getPlanProgress
12
- } from "../chunk-QLPTHTVB.js";
13
- import "../chunk-YZFATT7X.js";
14
-
15
- // src/cli/plan.ts
16
- import { readFileSync, writeFileSync } from "fs";
17
- function parseArg(args, flag) {
18
- const idx = args.indexOf(flag);
19
- return idx >= 0 && idx + 1 < args.length ? args[idx + 1] : void 0;
20
- }
21
- async function compileCommand(args) {
22
- const inputPath = args.find((a) => !a.startsWith("--"));
23
- if (!inputPath) {
24
- process.stderr.write("Usage: neuroverse plan compile <plan.md> [--output plan.json]\n");
25
- process.exit(PLAN_EXIT_CODES.ERROR);
26
- return;
27
- }
28
- const outputPath = parseArg(args, "--output") ?? inputPath.replace(/\.md$/, ".json");
29
- let markdown;
30
- try {
31
- markdown = readFileSync(inputPath, "utf-8");
32
- } catch (err) {
33
- process.stderr.write(`Error reading ${inputPath}: ${err}
34
- `);
35
- process.exit(PLAN_EXIT_CODES.ERROR);
36
- return;
37
- }
38
- const result = parsePlanMarkdown(markdown);
39
- if (!result.success || !result.plan) {
40
- process.stderr.write(`Parse errors:
41
- `);
42
- for (const error of result.errors) {
43
- process.stderr.write(` - ${error}
44
- `);
45
- }
46
- process.exit(PLAN_EXIT_CODES.ERROR);
47
- return;
48
- }
49
- writeFileSync(outputPath, JSON.stringify(result.plan, null, 2) + "\n");
50
- const plan = result.plan;
51
- process.stdout.write(`Plan compiled: ${plan.plan_id}
52
- `);
53
- process.stdout.write(` Objective: ${plan.objective}
54
- `);
55
- process.stdout.write(` Steps: ${plan.steps.length}
56
- `);
57
- process.stdout.write(` Constraints: ${plan.constraints.length}
58
- `);
59
- process.stdout.write(` Sequential: ${plan.sequential}
60
- `);
61
- process.stdout.write(` Completion: ${plan.completion}
62
- `);
63
- if (plan.world_id) process.stdout.write(` World: ${plan.world_id}
64
- `);
65
- if (plan.expires_at) process.stdout.write(` Expires: ${plan.expires_at}
66
- `);
67
- process.stdout.write(` Output: ${outputPath}
68
- `);
69
- }
70
- async function checkCommand(args) {
71
- const planPath = parseArg(args, "--plan");
72
- if (!planPath) {
73
- process.stderr.write(`Usage: echo '{"intent":"..."}' | neuroverse plan check --plan plan.json
74
- `);
75
- process.exit(PLAN_EXIT_CODES.ERROR);
76
- return;
77
- }
78
- let plan;
79
- try {
80
- plan = JSON.parse(readFileSync(planPath, "utf-8"));
81
- } catch (err) {
82
- process.stderr.write(`Error reading plan: ${err}
83
- `);
84
- process.exit(PLAN_EXIT_CODES.ERROR);
85
- return;
86
- }
87
- const stdinData = await readStdin();
88
- let event;
89
- try {
90
- event = JSON.parse(stdinData);
91
- } catch {
92
- process.stderr.write('Error: stdin must be valid JSON with an "intent" field.\n');
93
- process.exit(PLAN_EXIT_CODES.ERROR);
94
- return;
95
- }
96
- if (!event.intent) {
97
- process.stderr.write('Error: event must have an "intent" field.\n');
98
- process.exit(PLAN_EXIT_CODES.ERROR);
99
- return;
100
- }
101
- const worldPath = parseArg(args, "--world");
102
- if (worldPath) {
103
- const { loadWorld } = await import("../world-loader-HMPTOEA2.js");
104
- const { evaluateGuard } = await import("../guard-engine-QFMIBWJY.js");
105
- const world = await loadWorld(worldPath);
106
- const verdict2 = evaluateGuard(event, world, { plan });
107
- process.stdout.write(JSON.stringify(verdict2, null, 2) + "\n");
108
- const exitCode2 = verdict2.status === "ALLOW" ? 0 : verdict2.status === "BLOCK" ? 1 : 2;
109
- process.exit(exitCode2);
110
- return;
111
- }
112
- const verdict = evaluatePlan(event, plan);
113
- process.stdout.write(JSON.stringify(verdict, null, 2) + "\n");
114
- const exitCode = PLAN_EXIT_CODES[verdict.status] ?? PLAN_EXIT_CODES.ERROR;
115
- process.exit(exitCode);
116
- }
117
- async function statusCommand(args) {
118
- const planPath = parseArg(args, "--plan");
119
- if (!planPath) {
120
- process.stderr.write("Usage: neuroverse plan status --plan plan.json\n");
121
- process.exit(PLAN_EXIT_CODES.ERROR);
122
- return;
123
- }
124
- let plan;
125
- try {
126
- plan = JSON.parse(readFileSync(planPath, "utf-8"));
127
- } catch (err) {
128
- process.stderr.write(`Error reading plan: ${err}
129
- `);
130
- process.exit(PLAN_EXIT_CODES.ERROR);
131
- return;
132
- }
133
- const progress = getPlanProgress(plan);
134
- process.stdout.write(`Plan: ${plan.plan_id}
135
- `);
136
- process.stdout.write(`Objective: ${plan.objective}
137
- `);
138
- process.stdout.write(`Completion: ${plan.completion ?? "trust"}
139
- `);
140
- process.stdout.write(`Progress: ${progress.completed}/${progress.total} (${progress.percentage}%)
141
- `);
142
- process.stdout.write(`
143
- Steps:
144
- `);
145
- for (const step of plan.steps) {
146
- const status = step.status === "completed" ? "[x]" : step.status === "active" ? "[>]" : step.status === "skipped" ? "[-]" : "[ ]";
147
- let line = ` ${status} ${step.label}`;
148
- if (step.tags?.length) line += ` [tag: ${step.tags.join(", ")}]`;
149
- if (step.verify) line += ` [verify: ${step.verify}]`;
150
- if (step.requires?.length) line += ` (after: ${step.requires.join(", ")})`;
151
- process.stdout.write(line + "\n");
152
- }
153
- if (plan.constraints.length > 0) {
154
- process.stdout.write(`
155
- Constraints:
156
- `);
157
- for (const c of plan.constraints) {
158
- process.stdout.write(` - ${c.description} [${c.type}/${c.enforcement}]
159
- `);
160
- }
161
- }
162
- }
163
- async function advanceCommand(args) {
164
- const stepId = args.find((a) => !a.startsWith("--"));
165
- const planPath = parseArg(args, "--plan");
166
- if (!stepId || !planPath) {
167
- process.stderr.write("Usage: neuroverse plan advance <step_id> --plan plan.json [--evidence <type> --proof <proof>]\n");
168
- process.exit(PLAN_EXIT_CODES.ERROR);
169
- return;
170
- }
171
- let plan;
172
- try {
173
- plan = JSON.parse(readFileSync(planPath, "utf-8"));
174
- } catch (err) {
175
- process.stderr.write(`Error reading plan: ${err}
176
- `);
177
- process.exit(PLAN_EXIT_CODES.ERROR);
178
- return;
179
- }
180
- const evidenceType = parseArg(args, "--evidence");
181
- const evidenceProof = parseArg(args, "--proof");
182
- let evidence;
183
- if (evidenceType && evidenceProof) {
184
- evidence = {
185
- type: evidenceType,
186
- proof: evidenceProof,
187
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
188
- };
189
- } else if (evidenceType || evidenceProof) {
190
- process.stderr.write("Error: --evidence and --proof must both be provided.\n");
191
- process.exit(PLAN_EXIT_CODES.ERROR);
192
- return;
193
- }
194
- const result = advancePlan(plan, stepId, evidence);
195
- if (!result.success) {
196
- process.stderr.write(`Error: ${result.reason}
197
- `);
198
- process.exit(PLAN_EXIT_CODES.ERROR);
199
- return;
200
- }
201
- writeFileSync(planPath, JSON.stringify(result.plan, null, 2) + "\n");
202
- const progress = getPlanProgress(result.plan);
203
- const step = plan.steps.find((s) => s.id === stepId);
204
- process.stdout.write(`Step completed: ${step.label}
205
- `);
206
- if (result.evidence) {
207
- process.stdout.write(`Evidence: ${result.evidence.type} = ${result.evidence.proof}
208
- `);
209
- }
210
- process.stdout.write(`Progress: ${progress.completed}/${progress.total} (${progress.percentage}%)
211
- `);
212
- if (progress.completed === progress.total) {
213
- process.stdout.write(`
214
- Plan complete!
215
- `);
216
- }
217
- }
218
- async function deriveCommand(args) {
219
- const inputPath = args.find((a) => !a.startsWith("--"));
220
- if (!inputPath) {
221
- process.stderr.write("Usage: neuroverse plan derive <plan.md> [--output ./world/]\n");
222
- process.exit(PLAN_EXIT_CODES.ERROR);
223
- return;
224
- }
225
- const outputDir = parseArg(args, "--output") ?? "./derived-world/";
226
- let markdown;
227
- try {
228
- markdown = readFileSync(inputPath, "utf-8");
229
- } catch (err) {
230
- process.stderr.write(`Error reading ${inputPath}: ${err}
231
- `);
232
- process.exit(PLAN_EXIT_CODES.ERROR);
233
- return;
234
- }
235
- const result = parsePlanMarkdown(markdown);
236
- if (!result.success || !result.plan) {
237
- process.stderr.write(`Parse errors:
238
- `);
239
- for (const error of result.errors) {
240
- process.stderr.write(` - ${error}
241
- `);
242
- }
243
- process.exit(PLAN_EXIT_CODES.ERROR);
244
- return;
245
- }
246
- const plan = result.plan;
247
- const { mkdirSync } = await import("fs");
248
- mkdirSync(outputDir, { recursive: true });
249
- const worldJson = {
250
- world_id: `plan_${plan.plan_id}`,
251
- name: `Derived: ${plan.objective}`,
252
- thesis: plan.objective,
253
- version: "1.0.0",
254
- runtime_mode: "COMPLIANCE",
255
- default_assumption_profile: "default",
256
- default_alternative_profile: "default",
257
- modules: ["governance"],
258
- players: { thinking_space: true, experience_space: false, action_space: true }
259
- };
260
- const invariants = plan.constraints.map((c, i) => ({
261
- id: `inv_${c.id}`,
262
- label: c.description,
263
- type: "structural",
264
- enforcement: c.enforcement === "block" ? "hard" : "soft"
265
- }));
266
- const guards = {
267
- intent_vocabulary: {},
268
- guards: plan.steps.map((step) => {
269
- const patternKey = `plan_step_${step.id}`;
270
- return {
271
- id: `guard_${step.id}`,
272
- label: `Plan step: ${step.label}`,
273
- description: `Governs execution of plan step: ${step.label}`,
274
- category: "operational",
275
- enforcement: "warn",
276
- intent_patterns: [patternKey],
277
- appliesTo: step.tools ?? [],
278
- default_enabled: true,
279
- immutable: false
280
- };
281
- })
282
- };
283
- for (const step of plan.steps) {
284
- const keywords = step.label.toLowerCase().split(/\s+/).filter((w) => w.length > 3);
285
- const pattern = keywords.map((k) => `(?=.*${k})`).join("") + ".*";
286
- guards.intent_vocabulary[`plan_step_${step.id}`] = {
287
- pattern,
288
- description: step.label
289
- };
290
- }
291
- writeFileSync(`${outputDir}/world.json`, JSON.stringify(worldJson, null, 2) + "\n");
292
- writeFileSync(`${outputDir}/invariants.json`, JSON.stringify(invariants, null, 2) + "\n");
293
- writeFileSync(`${outputDir}/guards.json`, JSON.stringify(guards, null, 2) + "\n");
294
- process.stdout.write(`World derived from plan: ${plan.plan_id}
295
- `);
296
- process.stdout.write(` Output: ${outputDir}
297
- `);
298
- process.stdout.write(` Files: world.json, invariants.json, guards.json
299
- `);
300
- process.stdout.write(` Guards: ${plan.steps.length} (one per step)
301
- `);
302
- process.stdout.write(` Invariants: ${plan.constraints.length} (one per constraint)
303
- `);
304
- }
305
- var PLAN_USAGE = `
306
- neuroverse plan \u2014 Plan enforcement for AI agents.
307
-
308
- Subcommands:
309
- compile Parse plan markdown into plan.json
310
- check Check an action against a plan (stdin \u2192 stdout)
311
- status Show plan progress
312
- advance Mark a step as completed
313
- derive Generate a full world from a plan
314
-
315
- Usage:
316
- neuroverse plan compile <plan.md> [--output plan.json]
317
- echo '{"intent":"..."}' | neuroverse plan check --plan plan.json [--world ./world/]
318
- neuroverse plan status --plan plan.json
319
- neuroverse plan advance <step_id> --plan plan.json
320
- neuroverse plan derive <plan.md> [--output ./world/]
321
- `.trim();
322
- async function main(args) {
323
- const subcommand = args[0];
324
- const subArgs = args.slice(1);
325
- switch (subcommand) {
326
- case "compile":
327
- return compileCommand(subArgs);
328
- case "check":
329
- return checkCommand(subArgs);
330
- case "status":
331
- return statusCommand(subArgs);
332
- case "advance":
333
- return advanceCommand(subArgs);
334
- case "derive":
335
- return deriveCommand(subArgs);
336
- case "--help":
337
- case "-h":
338
- case "help":
339
- case void 0:
340
- process.stdout.write(PLAN_USAGE + "\n");
341
- process.exit(0);
342
- break;
343
- default:
344
- process.stderr.write(`Unknown plan subcommand: "${subcommand}"
345
-
346
- `);
347
- process.stdout.write(PLAN_USAGE + "\n");
348
- process.exit(1);
349
- }
350
- }
351
- export {
352
- main
353
- };