@neuroverseos/governance 0.9.0 → 0.11.0

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 (99) hide show
  1. package/README.md +1 -1
  2. package/dist/adapters/autoresearch.cjs +19 -1
  3. package/dist/adapters/autoresearch.d.cts +1 -1
  4. package/dist/adapters/autoresearch.d.ts +1 -1
  5. package/dist/adapters/autoresearch.js +2 -2
  6. package/dist/adapters/deep-agents.cjs +19 -1
  7. package/dist/adapters/deep-agents.d.cts +2 -2
  8. package/dist/adapters/deep-agents.d.ts +2 -2
  9. package/dist/adapters/deep-agents.js +2 -2
  10. package/dist/adapters/express.cjs +19 -1
  11. package/dist/adapters/express.d.cts +1 -1
  12. package/dist/adapters/express.d.ts +1 -1
  13. package/dist/adapters/express.js +2 -2
  14. package/dist/adapters/github.cjs +19 -1
  15. package/dist/adapters/github.d.cts +2 -2
  16. package/dist/adapters/github.d.ts +2 -2
  17. package/dist/adapters/github.js +2 -2
  18. package/dist/adapters/index.cjs +19 -1
  19. package/dist/adapters/index.d.cts +2 -2
  20. package/dist/adapters/index.d.ts +2 -2
  21. package/dist/adapters/index.js +8 -8
  22. package/dist/adapters/langchain.cjs +19 -1
  23. package/dist/adapters/langchain.d.cts +2 -2
  24. package/dist/adapters/langchain.d.ts +2 -2
  25. package/dist/adapters/langchain.js +2 -2
  26. package/dist/adapters/mentraos.cjs +19 -1
  27. package/dist/adapters/mentraos.d.cts +2 -2
  28. package/dist/adapters/mentraos.d.ts +2 -2
  29. package/dist/adapters/mentraos.js +2 -2
  30. package/dist/adapters/openai.cjs +19 -1
  31. package/dist/adapters/openai.d.cts +2 -2
  32. package/dist/adapters/openai.d.ts +2 -2
  33. package/dist/adapters/openai.js +2 -2
  34. package/dist/adapters/openclaw.cjs +19 -1
  35. package/dist/adapters/openclaw.d.cts +2 -2
  36. package/dist/adapters/openclaw.d.ts +2 -2
  37. package/dist/adapters/openclaw.js +2 -2
  38. package/dist/admin/index.cjs +19 -1
  39. package/dist/admin/index.js +1 -1
  40. package/dist/audit-CRJOB4CP.js +93 -0
  41. package/dist/audit-behavior-C62FdRAC.d.cts +100 -0
  42. package/dist/audit-behavior-DFy7LeYv.d.ts +100 -0
  43. package/dist/{behavioral-SPWPGYXL.js → behavioral-4TKMHZQZ.js} +2 -2
  44. package/dist/{chunk-OQU65525.js → chunk-24YW7BHC.js} +1 -1
  45. package/dist/{chunk-3ZWU7C43.js → chunk-2KTPIE57.js} +494 -14
  46. package/dist/{chunk-TJ5L2UTE.js → chunk-5K3LATTM.js} +1 -1
  47. package/dist/{chunk-HDNDL6D5.js → chunk-5LDBYOSJ.js} +1 -1
  48. package/dist/{chunk-FDPPZLSQ.js → chunk-5ZWKM7MO.js} +1 -1
  49. package/dist/{chunk-B3IIPTY3.js → chunk-6MB6TMAG.js} +1 -1
  50. package/dist/{chunk-IOVXB6QN.js → chunk-GXTAHCND.js} +1 -1
  51. package/dist/{chunk-FKQCPRKI.js → chunk-MAOIHKFO.js} +1 -1
  52. package/dist/{chunk-ZAF6JH23.js → chunk-MBOW6YXN.js} +19 -1
  53. package/dist/{chunk-A2UZTLRV.js → chunk-MLXKSX3L.js} +1 -1
  54. package/dist/{chunk-7FL3U7Z5.js → chunk-MWGEXHOD.js} +1 -1
  55. package/dist/{chunk-6CV4XG3J.js → chunk-QFDFAWZ6.js} +1 -1
  56. package/dist/{chunk-2VAWP6FI.js → chunk-RAS62JXV.js} +1 -1
  57. package/dist/{chunk-OTZU76DH.js → chunk-XAF3CYCW.js} +1 -1
  58. package/dist/{chunk-T6GMRZWC.js → chunk-XTYQCTDD.js} +1 -1
  59. package/dist/{chunk-TIXVEPS2.js → chunk-YN7OI5ZV.js} +1 -1
  60. package/dist/cli/neuroverse.cjs +999 -111
  61. package/dist/cli/neuroverse.js +16 -12
  62. package/dist/cli/plan.cjs +18 -0
  63. package/dist/cli/radiant.cjs +814 -17
  64. package/dist/cli/radiant.d.cts +44 -1
  65. package/dist/cli/radiant.d.ts +44 -1
  66. package/dist/cli/radiant.js +295 -7
  67. package/dist/cli/run.cjs +18 -0
  68. package/dist/cli/run.js +4 -4
  69. package/dist/{decision-flow-IJPNMVQK.js → decision-flow-5VI5YG6A.js} +2 -2
  70. package/dist/{demo-6W3YXLAX.js → demo-GYX6CYHC.js} +2 -2
  71. package/dist/engine/guard-engine.cjs +19 -1
  72. package/dist/engine/guard-engine.d.cts +21 -1
  73. package/dist/engine/guard-engine.d.ts +21 -1
  74. package/dist/engine/guard-engine.js +1 -1
  75. package/dist/{equity-penalties-CCO3GVHS.js → equity-penalties-NOM46NEO.js} +2 -2
  76. package/dist/{guard-IHJEKHL2.js → guard-PQ3SYV4Y.js} +3 -3
  77. package/dist/{guard-contract-ddiIPlOg.d.cts → guard-contract-Oznf-Kgq.d.cts} +32 -0
  78. package/dist/{guard-contract-q6HJAq3Q.d.ts → guard-contract-w_i_6gh-.d.ts} +32 -0
  79. package/dist/{impact-WIAM66IH.js → impact-LDJLTVRU.js} +3 -3
  80. package/dist/index.cjs +62 -1
  81. package/dist/index.d.cts +4 -3
  82. package/dist/index.d.ts +4 -3
  83. package/dist/index.js +49 -8
  84. package/dist/{mcp-server-CKYBHXWK.js → mcp-server-W3MWSKD7.js} +2 -2
  85. package/dist/{playground-3TTBN7XD.js → playground-SSZRNUAF.js} +1 -1
  86. package/dist/radiant/index.cjs +517 -14
  87. package/dist/radiant/index.d.cts +180 -10
  88. package/dist/radiant/index.d.ts +180 -10
  89. package/dist/radiant/index.js +12 -2
  90. package/dist/{redteam-W644UMWN.js → redteam-KCULS7EW.js} +1 -1
  91. package/dist/{server-JKUBUK5H.js → server-EGRGGSM2.js} +2 -2
  92. package/dist/{session-FMAROEIE.js → session-PZLTL22G.js} +2 -2
  93. package/dist/{shared-PpalGKxc.d.cts → shared-BC8mOpt0.d.cts} +1 -1
  94. package/dist/{shared-DAzdfWtU.d.ts → shared-CP63gNNW.d.ts} +1 -1
  95. package/dist/{test-XDB2DH3L.js → test-LIHGWHBA.js} +1 -1
  96. package/dist/{trace-2YDNAXMK.js → trace-DC3D7XPD.js} +2 -2
  97. package/examples/radiant-weekly-workflow.yml +4 -1
  98. package/package.json +1 -1
  99. /package/dist/{doctor-XEMLO6UA.js → doctor-SIWQGTAO.js} +0 -0
@@ -322,8 +322,26 @@ function isExternalScope(scope) {
322
322
  ];
323
323
  return !internalPatterns.some((p) => p.test(scope));
324
324
  }
325
- var MAX_INPUT_LENGTH = 1e5;
326
325
  function evaluateGuard(event, world, options = {}) {
326
+ const verdict = evaluateGuardCore(event, world, options);
327
+ return options.mode === "observe" ? toShadowVerdict(verdict) : verdict;
328
+ }
329
+ function toShadowVerdict(verdict) {
330
+ if (verdict.status === "ALLOW") return verdict;
331
+ return {
332
+ ...verdict,
333
+ status: "ALLOW",
334
+ shadowStatus: verdict.status,
335
+ shadowReason: verdict.reason,
336
+ // Preserve the original reason as shadowReason and wipe the
337
+ // top-level reason so callers that display `reason` for BLOCK/PAUSE
338
+ // don't accidentally surface an enforcement message.
339
+ reason: void 0,
340
+ warning: verdict.reason ? `Observe mode: would have ${verdict.status.toLowerCase()} \u2014 ${verdict.reason}` : `Observe mode: would have ${verdict.status.toLowerCase()}`
341
+ };
342
+ }
343
+ var MAX_INPUT_LENGTH = 1e5;
344
+ function evaluateGuardCore(event, world, options = {}) {
327
345
  const startTime = performance.now();
328
346
  const level = options.level ?? "standard";
329
347
  const includeTrace = options.trace ?? false;
@@ -3,7 +3,7 @@ import {
3
3
  } from "../chunk-GJ6LM4JZ.js";
4
4
  import {
5
5
  evaluateGuard
6
- } from "../chunk-ZAF6JH23.js";
6
+ } from "../chunk-MBOW6YXN.js";
7
7
  import "../chunk-QLPTHTVB.js";
8
8
  import "../chunk-QWGCMQQD.js";
9
9
 
@@ -0,0 +1,93 @@
1
+ import {
2
+ readStdin
3
+ } from "./chunk-BQZMOEML.js";
4
+ import {
5
+ resolveWorldPath
6
+ } from "./chunk-AKW5YVCE.js";
7
+ import {
8
+ loadWorld
9
+ } from "./chunk-I4RTIMLX.js";
10
+ import {
11
+ evaluateGuard
12
+ } from "./chunk-MBOW6YXN.js";
13
+ import "./chunk-QLPTHTVB.js";
14
+ import "./chunk-QWGCMQQD.js";
15
+
16
+ // src/cli/audit.ts
17
+ function parseArgs(argv) {
18
+ let worldPath = "";
19
+ let trace = false;
20
+ let level;
21
+ let multi = false;
22
+ let crossingsOnly = false;
23
+ for (let i = 0; i < argv.length; i++) {
24
+ const a = argv[i];
25
+ if (a === "--world") worldPath = argv[++i] ?? "";
26
+ else if (a === "--trace") trace = true;
27
+ else if (a === "--level") {
28
+ const v = argv[++i];
29
+ if (v === "basic" || v === "standard" || v === "strict") level = v;
30
+ } else if (a === "--multi") multi = true;
31
+ else if (a === "--crossings-only") crossingsOnly = true;
32
+ }
33
+ return { worldPath, trace, level, multi, crossingsOnly };
34
+ }
35
+ function usage() {
36
+ process.stderr.write(
37
+ "Usage: neuroverse audit --world <path> [--trace] [--level basic|standard|strict] [--multi] [--crossings-only]\n\nReads GuardEvent JSON from stdin. With --multi, reads a JSON array.\nEvaluates in observe mode \u2014 no enforcement. Verdicts carry\nshadowStatus/shadowReason for any event that would have crossed.\n"
38
+ );
39
+ }
40
+ async function main(argv = process.argv.slice(2)) {
41
+ const args = parseArgs(argv);
42
+ if (!args.worldPath) {
43
+ usage();
44
+ process.exit(1);
45
+ }
46
+ let world;
47
+ try {
48
+ const resolved = resolveWorldPath(args.worldPath);
49
+ world = await loadWorld(resolved);
50
+ } catch (err) {
51
+ process.stderr.write(`Failed to load world: ${err instanceof Error ? err.message : err}
52
+ `);
53
+ process.exit(1);
54
+ }
55
+ let raw = "";
56
+ try {
57
+ raw = await readStdin();
58
+ } catch (err) {
59
+ process.stderr.write(`Failed to read stdin: ${err instanceof Error ? err.message : err}
60
+ `);
61
+ process.exit(1);
62
+ }
63
+ if (!raw.trim()) {
64
+ process.stderr.write("No input on stdin. Pipe a GuardEvent or a JSON array with --multi.\n");
65
+ process.exit(1);
66
+ }
67
+ let parsed;
68
+ try {
69
+ parsed = JSON.parse(raw);
70
+ } catch (err) {
71
+ process.stderr.write(`Invalid JSON on stdin: ${err instanceof Error ? err.message : err}
72
+ `);
73
+ process.exit(1);
74
+ }
75
+ const options = { trace: args.trace, level: args.level, mode: "observe" };
76
+ if (args.multi) {
77
+ if (!Array.isArray(parsed)) {
78
+ process.stderr.write("--multi expects a JSON array on stdin.\n");
79
+ process.exit(1);
80
+ }
81
+ const verdicts = parsed.map(
82
+ (e) => evaluateGuard(e, world, options)
83
+ );
84
+ const out = args.crossingsOnly ? verdicts.filter((v) => v.shadowStatus && v.shadowStatus !== "ALLOW") : verdicts;
85
+ process.stdout.write(JSON.stringify(out, null, 2) + "\n");
86
+ return;
87
+ }
88
+ const verdict = evaluateGuard(parsed, world, options);
89
+ process.stdout.write(JSON.stringify(verdict, null, 2) + "\n");
90
+ }
91
+ export {
92
+ main
93
+ };
@@ -0,0 +1,100 @@
1
+ import { d as GuardStatus, G as GuardVerdict } from './guard-contract-Oznf-Kgq.cjs';
2
+ import { WorldDefinition } from './types.cjs';
3
+
4
+ /**
5
+ * @neuroverseos/governance — auditBehavior
6
+ *
7
+ * Takes an observed event (from the Radiant pipeline: a commit, a PR, a
8
+ * Slack message, a Notion edit) and evaluates it against a worldmodel in
9
+ * observe mode — without any enforcement side effects. Returns the shadow
10
+ * verdict so callers can record crossings of declared invariants.
11
+ *
12
+ * This is the primitive that lets Bevia / Radiant / Mirror-Mode tooling
13
+ * show leaders where their worldmodel is being bumped against, without
14
+ * imposing any stop/pause/modify semantics on the team's work.
15
+ *
16
+ * Relationship to evaluateGuard:
17
+ *
18
+ * evaluateGuard({ intent, ... }, world, { mode: 'enforce' })
19
+ * → what an AI agent receives when governance says "BLOCK this action"
20
+ *
21
+ * evaluateGuard({ intent, ... }, world, { mode: 'observe' })
22
+ * → what tooling like Bevia receives when governance says "this would
23
+ * have been blocked if enforced, but pass through and record"
24
+ *
25
+ * auditBehavior(event, world)
26
+ * → convenience on top of the observe path that (a) maps a
27
+ * behavioral event into a synthetic GuardEvent, (b) calls
28
+ * evaluateGuard in observe mode, and (c) returns a Crossing
29
+ * record shaped for behavioral logs.
30
+ *
31
+ * The mapping from behavioral events to GuardEvents is intentionally
32
+ * conservative: we use the event's `kind` as the tool, its `content` as
33
+ * the intent, and pass through timestamp + actor as metadata. Callers
34
+ * that want richer mappings (classifying event semantics into tool
35
+ * namespaces, etc.) can construct a GuardEvent directly and call
36
+ * evaluateGuard themselves.
37
+ */
38
+
39
+ /**
40
+ * Minimal shape an observed event needs to be auditable. Matches the
41
+ * Radiant `Event` type's relevant fields but doesn't require importing
42
+ * the full radiant domain module — keeps auditBehavior consumable by any
43
+ * adapter that emits events.
44
+ */
45
+ interface AuditableEvent {
46
+ /** Source-system-unique id (e.g. "github-push-abc123", "slack-msg-789"). */
47
+ id: string;
48
+ /** ISO 8601. */
49
+ timestamp: string;
50
+ /** Free-form kind tag from the adapter — 'commit', 'pr_opened', 'chat_message', etc. */
51
+ kind?: string;
52
+ /** Textual content of the event — commit message, PR body, chat text, etc. */
53
+ content?: string;
54
+ /** Actor id that produced the event. */
55
+ actorId?: string;
56
+ /** Actor kind — 'human' | 'ai' | 'bot' | 'unknown'. */
57
+ actorKind?: string;
58
+ /** Optional repo / channel / page reference, passed through as GuardEvent.scope. */
59
+ scope?: string;
60
+ }
61
+ /**
62
+ * A single crossing record — an observed event that would have triggered
63
+ * a non-ALLOW verdict if the world were running in enforce mode.
64
+ *
65
+ * When `wouldHaveBlocked` is `false`, the event passed all layers cleanly
66
+ * and no crossing occurred. Crossing records are most useful when
67
+ * `wouldHaveBlocked` is `true` — that's a moment the leader said they
68
+ * cared about, and here's evidence their team bumped into it.
69
+ */
70
+ interface Crossing {
71
+ eventId: string;
72
+ timestamp: string;
73
+ kind?: string;
74
+ actorId?: string;
75
+ /** The status the engine would have returned in enforce mode. */
76
+ shadowStatus: GuardStatus;
77
+ /** Human-readable reason the shadow verdict fired. */
78
+ shadowReason?: string;
79
+ /** Rule or guard id that produced the shadow verdict. */
80
+ ruleId?: string;
81
+ /** Shortened quote of the event content — useful for a crossings panel. */
82
+ excerpt?: string;
83
+ /** True when the engine would have blocked/paused/etc. in enforce mode. */
84
+ wouldHaveBlocked: boolean;
85
+ /** Full verdict in case callers want the complete object. */
86
+ verdict: GuardVerdict;
87
+ }
88
+ /**
89
+ * Evaluate a single behavioral event against a world in observe mode.
90
+ */
91
+ declare function auditBehavior(event: AuditableEvent, world: WorldDefinition): Crossing;
92
+ /**
93
+ * Convenience: audit a whole stream of events. Returns one Crossing per
94
+ * event; the caller can filter `wouldHaveBlocked` to get only the
95
+ * interesting ones. Deterministic — same events + same world = same
96
+ * crossings, every time.
97
+ */
98
+ declare function auditBehaviors(events: AuditableEvent[], world: WorldDefinition): Crossing[];
99
+
100
+ export { type AuditableEvent as A, type Crossing as C, auditBehavior as a, auditBehaviors as b };
@@ -0,0 +1,100 @@
1
+ import { d as GuardStatus, G as GuardVerdict } from './guard-contract-w_i_6gh-.js';
2
+ import { WorldDefinition } from './types.js';
3
+
4
+ /**
5
+ * @neuroverseos/governance — auditBehavior
6
+ *
7
+ * Takes an observed event (from the Radiant pipeline: a commit, a PR, a
8
+ * Slack message, a Notion edit) and evaluates it against a worldmodel in
9
+ * observe mode — without any enforcement side effects. Returns the shadow
10
+ * verdict so callers can record crossings of declared invariants.
11
+ *
12
+ * This is the primitive that lets Bevia / Radiant / Mirror-Mode tooling
13
+ * show leaders where their worldmodel is being bumped against, without
14
+ * imposing any stop/pause/modify semantics on the team's work.
15
+ *
16
+ * Relationship to evaluateGuard:
17
+ *
18
+ * evaluateGuard({ intent, ... }, world, { mode: 'enforce' })
19
+ * → what an AI agent receives when governance says "BLOCK this action"
20
+ *
21
+ * evaluateGuard({ intent, ... }, world, { mode: 'observe' })
22
+ * → what tooling like Bevia receives when governance says "this would
23
+ * have been blocked if enforced, but pass through and record"
24
+ *
25
+ * auditBehavior(event, world)
26
+ * → convenience on top of the observe path that (a) maps a
27
+ * behavioral event into a synthetic GuardEvent, (b) calls
28
+ * evaluateGuard in observe mode, and (c) returns a Crossing
29
+ * record shaped for behavioral logs.
30
+ *
31
+ * The mapping from behavioral events to GuardEvents is intentionally
32
+ * conservative: we use the event's `kind` as the tool, its `content` as
33
+ * the intent, and pass through timestamp + actor as metadata. Callers
34
+ * that want richer mappings (classifying event semantics into tool
35
+ * namespaces, etc.) can construct a GuardEvent directly and call
36
+ * evaluateGuard themselves.
37
+ */
38
+
39
+ /**
40
+ * Minimal shape an observed event needs to be auditable. Matches the
41
+ * Radiant `Event` type's relevant fields but doesn't require importing
42
+ * the full radiant domain module — keeps auditBehavior consumable by any
43
+ * adapter that emits events.
44
+ */
45
+ interface AuditableEvent {
46
+ /** Source-system-unique id (e.g. "github-push-abc123", "slack-msg-789"). */
47
+ id: string;
48
+ /** ISO 8601. */
49
+ timestamp: string;
50
+ /** Free-form kind tag from the adapter — 'commit', 'pr_opened', 'chat_message', etc. */
51
+ kind?: string;
52
+ /** Textual content of the event — commit message, PR body, chat text, etc. */
53
+ content?: string;
54
+ /** Actor id that produced the event. */
55
+ actorId?: string;
56
+ /** Actor kind — 'human' | 'ai' | 'bot' | 'unknown'. */
57
+ actorKind?: string;
58
+ /** Optional repo / channel / page reference, passed through as GuardEvent.scope. */
59
+ scope?: string;
60
+ }
61
+ /**
62
+ * A single crossing record — an observed event that would have triggered
63
+ * a non-ALLOW verdict if the world were running in enforce mode.
64
+ *
65
+ * When `wouldHaveBlocked` is `false`, the event passed all layers cleanly
66
+ * and no crossing occurred. Crossing records are most useful when
67
+ * `wouldHaveBlocked` is `true` — that's a moment the leader said they
68
+ * cared about, and here's evidence their team bumped into it.
69
+ */
70
+ interface Crossing {
71
+ eventId: string;
72
+ timestamp: string;
73
+ kind?: string;
74
+ actorId?: string;
75
+ /** The status the engine would have returned in enforce mode. */
76
+ shadowStatus: GuardStatus;
77
+ /** Human-readable reason the shadow verdict fired. */
78
+ shadowReason?: string;
79
+ /** Rule or guard id that produced the shadow verdict. */
80
+ ruleId?: string;
81
+ /** Shortened quote of the event content — useful for a crossings panel. */
82
+ excerpt?: string;
83
+ /** True when the engine would have blocked/paused/etc. in enforce mode. */
84
+ wouldHaveBlocked: boolean;
85
+ /** Full verdict in case callers want the complete object. */
86
+ verdict: GuardVerdict;
87
+ }
88
+ /**
89
+ * Evaluate a single behavioral event against a world in observe mode.
90
+ */
91
+ declare function auditBehavior(event: AuditableEvent, world: WorldDefinition): Crossing;
92
+ /**
93
+ * Convenience: audit a whole stream of events. Returns one Crossing per
94
+ * event; the caller can filter `wouldHaveBlocked` to get only the
95
+ * interesting ones. Deterministic — same events + same world = same
96
+ * crossings, every time.
97
+ */
98
+ declare function auditBehaviors(events: AuditableEvent[], world: WorldDefinition): Crossing[];
99
+
100
+ export { type AuditableEvent as A, type Crossing as C, auditBehavior as a, auditBehaviors as b };
@@ -5,8 +5,8 @@ import {
5
5
  } from "./chunk-CNSO6XW5.js";
6
6
  import {
7
7
  readAuditLog
8
- } from "./chunk-2VAWP6FI.js";
9
- import "./chunk-ZAF6JH23.js";
8
+ } from "./chunk-RAS62JXV.js";
9
+ import "./chunk-MBOW6YXN.js";
10
10
  import "./chunk-QLPTHTVB.js";
11
11
  import "./chunk-QWGCMQQD.js";
12
12
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readAuditLog
3
- } from "./chunk-2VAWP6FI.js";
3
+ } from "./chunk-RAS62JXV.js";
4
4
 
5
5
  // src/engine/impact-report.ts
6
6
  function generateImpactReport(events) {