@neuroverseos/governance 0.5.0 → 0.5.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 (113) hide show
  1. package/README.md +189 -0
  2. package/dist/adapters/autoresearch.d.cts +2 -1
  3. package/dist/adapters/autoresearch.d.ts +2 -1
  4. package/dist/adapters/autoresearch.js +2 -2
  5. package/dist/adapters/deep-agents.d.cts +3 -2
  6. package/dist/adapters/deep-agents.d.ts +3 -2
  7. package/dist/adapters/deep-agents.js +2 -2
  8. package/dist/adapters/express.d.cts +2 -1
  9. package/dist/adapters/express.d.ts +2 -1
  10. package/dist/adapters/express.js +2 -2
  11. package/dist/adapters/github.cjs +1697 -0
  12. package/dist/adapters/github.d.cts +225 -0
  13. package/dist/adapters/github.d.ts +225 -0
  14. package/dist/adapters/github.js +27 -0
  15. package/dist/adapters/index.d.cts +4 -316
  16. package/dist/adapters/index.d.ts +4 -316
  17. package/dist/adapters/index.js +23 -21
  18. package/dist/adapters/langchain.d.cts +3 -2
  19. package/dist/adapters/langchain.d.ts +3 -2
  20. package/dist/adapters/langchain.js +2 -2
  21. package/dist/adapters/mentraos.cjs +2181 -0
  22. package/dist/adapters/mentraos.d.cts +319 -0
  23. package/dist/adapters/mentraos.d.ts +319 -0
  24. package/dist/{mentraos-LLH7KEV4.js → adapters/mentraos.js} +12 -10
  25. package/dist/adapters/openai.d.cts +3 -2
  26. package/dist/adapters/openai.d.ts +3 -2
  27. package/dist/adapters/openai.js +2 -2
  28. package/dist/adapters/openclaw.d.cts +3 -2
  29. package/dist/adapters/openclaw.d.ts +3 -2
  30. package/dist/adapters/openclaw.js +2 -2
  31. package/dist/{add-LYHDZ5RL.js → add-JP7TC2K3.js} +1 -1
  32. package/dist/admin/index.cjs +2214 -0
  33. package/dist/admin/index.d.cts +362 -0
  34. package/dist/admin/index.d.ts +362 -0
  35. package/dist/admin/index.js +703 -0
  36. package/dist/bootstrap-contract-DcV6t-8M.d.cts +216 -0
  37. package/dist/bootstrap-contract-DcV6t-8M.d.ts +216 -0
  38. package/dist/{build-SCAWPA7E.js → build-THUEYMVT.js} +2 -2
  39. package/dist/{chunk-DWHUZUEY.js → chunk-5RAQ5DZW.js} +3 -3
  40. package/dist/{chunk-25XHSTPT.js → chunk-6UPEUMJ2.js} +3 -3
  41. package/dist/chunk-7UU7V3AD.js +447 -0
  42. package/dist/{chunk-UTH7OXTM.js → chunk-EK77AJAH.js} +22 -4
  43. package/dist/{chunk-BXLTEUS4.js → chunk-EQUAWNXW.js} +2 -2
  44. package/dist/chunk-FGOSKQDE.js +421 -0
  45. package/dist/{chunk-U6FRAEQJ.js → chunk-GJ6LM4JZ.js} +1 -441
  46. package/dist/chunk-H3REGQRI.js +107 -0
  47. package/dist/{chunk-5JUZ4HL7.js → chunk-LAKUB76X.js} +3 -3
  48. package/dist/{chunk-Y6WXAPKY.js → chunk-NTHXZAW4.js} +3 -3
  49. package/dist/{chunk-TD5GKIHP.js → chunk-R23T5SZG.js} +3 -3
  50. package/dist/{chunk-V4FZHJQX.js → chunk-RF2L5SYG.js} +3 -3
  51. package/dist/{chunk-YNYCQECH.js → chunk-TL4DLMMW.js} +3 -3
  52. package/dist/{chunk-JKGPSFGH.js → chunk-TZBERHFM.js} +3 -3
  53. package/dist/{chunk-MFKHTE5R.js → chunk-UZBW44KD.js} +3 -3
  54. package/dist/{chunk-7D7PZLB7.js → chunk-XPMZB46F.js} +3 -3
  55. package/dist/cli/neuroverse.cjs +1486 -321
  56. package/dist/cli/neuroverse.js +44 -20
  57. package/dist/cli/plan.js +2 -2
  58. package/dist/cli/run.cjs +242 -139
  59. package/dist/cli/run.js +23 -3
  60. package/dist/{demo-66MMJTEH.js → demo-N5K4VXJW.js} +4 -4
  61. package/dist/{derive-AUQE3L3P.js → derive-5LOMN7GO.js} +2 -2
  62. package/dist/{doctor-EY7LKSYY.js → doctor-Q5APJOTS.js} +3 -2
  63. package/dist/engine/bootstrap-emitter.cjs +241 -0
  64. package/dist/engine/bootstrap-emitter.d.cts +27 -0
  65. package/dist/engine/bootstrap-emitter.d.ts +27 -0
  66. package/dist/{bootstrap-emitter-GIMOJFOC.js → engine/bootstrap-emitter.js} +2 -2
  67. package/dist/engine/bootstrap-parser.cjs +560 -0
  68. package/dist/engine/bootstrap-parser.d.cts +96 -0
  69. package/dist/engine/bootstrap-parser.d.ts +96 -0
  70. package/dist/{bootstrap-parser-LBLGVEMU.js → engine/bootstrap-parser.js} +2 -2
  71. package/dist/engine/guard-engine.cjs +1116 -0
  72. package/dist/engine/guard-engine.d.cts +60 -0
  73. package/dist/engine/guard-engine.d.ts +60 -0
  74. package/dist/{guard-engine-N7TUIUU7.js → engine/guard-engine.js} +3 -3
  75. package/dist/engine/simulate-engine.cjs +390 -0
  76. package/dist/engine/simulate-engine.d.cts +105 -0
  77. package/dist/engine/simulate-engine.d.ts +105 -0
  78. package/dist/engine/simulate-engine.js +9 -0
  79. package/dist/{equity-penalties-WWC7UDQD.js → equity-penalties-PYCJ3Q4U.js} +6 -6
  80. package/dist/{explain-MUSGDT67.js → explain-42TVC3QD.js} +1 -1
  81. package/dist/{guard-W3BMQPBJ.js → guard-TPYDFG6V.js} +16 -4
  82. package/dist/{guard-contract-CLBbTGK_.d.ts → guard-contract-ddiIPlOg.d.cts} +2 -369
  83. package/dist/{guard-contract-CLBbTGK_.d.cts → guard-contract-q6HJAq3Q.d.ts} +2 -369
  84. package/dist/{improve-PJDAWW4Q.js → improve-HLZGJ54Z.js} +3 -3
  85. package/dist/index.cjs +471 -1
  86. package/dist/index.d.cts +14 -492
  87. package/dist/index.d.ts +14 -492
  88. package/dist/index.js +68 -47
  89. package/dist/keygen-BSZH3NM2.js +77 -0
  90. package/dist/{lens-IP6GIZ2Q.js → lens-NFGZHD76.js} +92 -25
  91. package/dist/{mcp-server-OG3PPVD2.js → mcp-server-5XXNG6VC.js} +2 -2
  92. package/dist/migrate-NH5PVMX4.js +221 -0
  93. package/dist/{playground-4BK2XQ47.js → playground-2EU5CFIH.js} +5 -5
  94. package/dist/{redteam-BRZALBPP.js → redteam-VK6OVHAE.js} +3 -3
  95. package/dist/{session-SGRUT2UH.js → session-NGA4DUPL.js} +2 -2
  96. package/dist/{shared-CwGpPheR.d.ts → shared-DAzdfWtU.d.ts} +1 -1
  97. package/dist/{shared-BGzmYP5g.d.cts → shared-PpalGKxc.d.cts} +1 -1
  98. package/dist/sign-RRELHKWM.js +11 -0
  99. package/dist/{simulate-FGXKIH7V.js → simulate-4YNOBMES.js} +2 -2
  100. package/dist/{test-PT44BSYG.js → test-HDBPMQTG.js} +3 -3
  101. package/dist/types.cjs +18 -0
  102. package/dist/types.d.cts +370 -0
  103. package/dist/types.d.ts +370 -0
  104. package/dist/types.js +0 -0
  105. package/dist/{validate-Q5O5TGLT.js → validate-6MFQZ2EG.js} +1 -1
  106. package/dist/verify-6AVTWX75.js +151 -0
  107. package/dist/{world-V52ZMH26.js → world-H5WVURKU.js} +1 -1
  108. package/dist/{world-loader-C4D3VPP3.js → world-loader-J47PCPDZ.js} +1 -1
  109. package/package.json +44 -3
  110. package/dist/{chunk-7QIAF377.js → chunk-CYDMUJVZ.js} +0 -0
  111. package/dist/{chunk-4G6WHPLI.js → chunk-QZ666FCV.js} +3 -3
  112. package/dist/{configure-ai-LL3VAPQW.js → configure-ai-5MP5DWTT.js} +3 -3
  113. package/dist/{decision-flow-3K4D72G4.js → decision-flow-IJPNMVQK.js} +3 -3
package/README.md CHANGED
@@ -7,6 +7,9 @@
7
7
 
8
8
  NeuroVerse is the governance layer for AI-powered devices. It gives users, developers, and organizations a single system to define permissions, behavioral personality, and role-based access — for smart glasses, phones, agents, or any AI-enabled product.
9
9
 
10
+ **Built for multi-agent systems:** when many agents are active, they all evaluate against the same deterministic governance model.
11
+ **Built for handoff:** governance is portable as world/plan artifacts, so teams can update policy quickly and hand it across agents, apps, and operators without rewriting core logic.
12
+
10
13
  ```
11
14
  What AI can do → Rules (permissions)
12
15
  How AI behaves → Lenses (personality)
@@ -17,6 +20,192 @@ One world file. One runtime. Every app on the device respects it.
17
20
 
18
21
  ---
19
22
 
23
+ ## What You Can Build With NeuroVerse
24
+
25
+ NeuroVerse is a **behavior + authority layer** for AI systems that act in the world.
26
+
27
+ Use it when you need AI or robots to behave differently based on:
28
+ - **Who is present** (user, manager, bystander, multi-agent team)
29
+ - **Where they are** (store, hospital, office, restricted zone, public street)
30
+ - **What authority applies** (personal policy, organization policy, local zone policy)
31
+ - **What level of autonomy is allowed** (allow, confirm, block, pause)
32
+
33
+ ### Typical developer use cases
34
+
35
+ 1. **Centralized fleet governance**
36
+ - One organization-defined world file applied across all devices and agents.
37
+ - Useful for enterprise robotics, smart-glasses deployments, and compliance-heavy apps.
38
+
39
+ 2. **Decentralized spatial governance**
40
+ - Devices encounter different local rules as they move through space.
41
+ - Rules compose at runtime (user + zone + multi-user handshake), and the most restrictive constraint wins.
42
+
43
+ 3. **Behavioral governance (not just permissions)**
44
+ - Define not only what AI can do, but how it should communicate, frame decisions, and ask for confirmation.
45
+
46
+ ### Behavior Building Blocks (Developer View)
47
+
48
+ NeuroVerse gives you composable primitives:
49
+
50
+ - **Worlds** → portable policy bundles (invariants, roles, rules, guards, lenses)
51
+ - **Plans** → temporary mission/task constraints layered on top of worlds
52
+ - **Guard Engine** → deterministic intent evaluation before action execution
53
+ - **Spatial Engine** → zone opt-in + handshake negotiation for mixed human/robot spaces
54
+ - **Adapters + MCP** → plug governance into OpenAI, LangChain, OpenClaw, Express/Fastify, and MCP clients
55
+
56
+ These blocks let you build robots/agents that can traverse heterogeneous spaces while remaining policy-compliant, auditable, and deterministic.
57
+
58
+ <<<<<<< codex/review-open-source-repo-for-ai-architecture
59
+ ### Mental Model: Layered Rules (World → Law → Situation)
60
+
61
+ If you're explaining this to developers or non-technical stakeholders, use this:
62
+
63
+ > We always operate under layered constraints.
64
+ > First: physical reality and our own capabilities.
65
+ > Second: legal/social rules (country/state/city).
66
+ > Third: situational rules from context or authority (school, workplace, parent, event host).
67
+
68
+ NeuroVerse maps directly to that structure:
69
+
70
+ 1. **World rules (persistent baseline)**
71
+ Equivalent to "physics + platform + constitutional constraints."
72
+ These are stable, reusable governance boundaries.
73
+
74
+ 2. **Role + domain rules (organizational/legal layer)**
75
+ Equivalent to "country/state/city rules."
76
+ These define what a specific actor is allowed to do in normal operation.
77
+
78
+ 3. **Plan rules (task/situational layer)**
79
+ Equivalent to "mom's trip rules" in a specific moment:
80
+ *"Bike home directly, don't stop at friends' houses, no wheelies."*
81
+ Plans are temporary overlays that **only restrict** scope further for the current mission.
82
+
83
+ In short: **World = permanent policy. Plan = temporary mission constraints.**
84
+ Both must pass for an action to proceed.
85
+
86
+ ### 5-Minute Quickstart (First ALLOW + First BLOCK)
87
+
88
+ This is the fastest path to validate value.
89
+
90
+ ```bash
91
+ # 1) Install
92
+ npm install @neuroverseos/governance
93
+
94
+ # 2) Scaffold + compile a world
95
+ npx neuroverse init
96
+ npx neuroverse build .nv-world.md
97
+
98
+ # 3) Evaluate a safe action (expect ALLOW)
99
+ echo '{"intent":"summarize daily notes","tool":"ai"}' | npx neuroverse guard --world ./world
100
+
101
+ # 4) Evaluate a risky action (expect BLOCK or PAUSE based on world)
102
+ echo '{"intent":"delete all records","tool":"database","irreversible":true}' | npx neuroverse guard --world ./world
103
+ ```
104
+
105
+ If you see both an allow path and a blocked/paused path, you've validated the core governance loop.
106
+
107
+ ### Built With NeuroVerse
108
+
109
+ Real implementations built on these primitives:
110
+
111
+ - **NeuroVerse Negotiator** — Multi-agent negotiation patterns and governance-aware world workflows.
112
+ https://github.com/NeuroverseOS/negotiator
113
+ - **NeuroVerse OpenClaw Governance Plugin** — Runtime plugin integrating NeuroVerse governance into OpenClaw execution flows.
114
+ https://github.com/NeuroverseOS/neuroverseos-openclaw-governance
115
+ - **Bevia** — Production-facing product context for governed AI behavior.
116
+ https://www.bevia.co
117
+
118
+ ### Integration Snippet Matrix (Copy/Paste)
119
+
120
+ | Stack | Install | Minimal integration |
121
+ |---|---|---|
122
+ | OpenAI | `npm i @neuroverseos/governance` | `import { createGovernedToolExecutor } from '@neuroverseos/governance/adapters/openai'` |
123
+ | LangChain | `npm i @neuroverseos/governance` | `import { createNeuroVerseCallbackHandler } from '@neuroverseos/governance/adapters/langchain'` |
124
+ | OpenClaw | `npm i @neuroverseos/governance` | `import { createNeuroVersePlugin } from '@neuroverseos/governance/adapters/openclaw'` |
125
+ | Express/Fastify | `npm i @neuroverseos/governance` | `import { createGovernanceMiddleware } from '@neuroverseos/governance/adapters/express'` |
126
+ | MCP | `npm i @neuroverseos/governance` | `npx neuroverse mcp --world ./world` |
127
+
128
+ <details>
129
+ <summary>OpenAI (governed tool execution)</summary>
130
+
131
+ ```typescript
132
+ import { createGovernedToolExecutor } from '@neuroverseos/governance/adapters/openai';
133
+
134
+ const executor = await createGovernedToolExecutor('./world/', { trace: true });
135
+ const result = await executor.execute(toolCall, myToolRunner);
136
+ ```
137
+ </details>
138
+
139
+ <details>
140
+ <summary>LangChain (callback handler)</summary>
141
+
142
+ ```typescript
143
+ import { createNeuroVerseCallbackHandler } from '@neuroverseos/governance/adapters/langchain';
144
+
145
+ const handler = await createNeuroVerseCallbackHandler('./world/', { trace: true });
146
+ ```
147
+ </details>
148
+
149
+ <details>
150
+ <summary>Express/Fastify middleware</summary>
151
+
152
+ ```typescript
153
+ import { createGovernanceMiddleware } from '@neuroverseos/governance/adapters/express';
154
+
155
+ const middleware = await createGovernanceMiddleware('./world/', { level: 'strict' });
156
+ app.use('/api', middleware);
157
+ ```
158
+ </details>
159
+
160
+ ### Governance in Action (Proof)
161
+
162
+ Use this section to show real runtime behavior and response time.
163
+
164
+ #### Scenario A — Safe action
165
+
166
+ ```json
167
+ {
168
+ "status": "ALLOW",
169
+ "reason": "Action allowed by policy",
170
+ "ruleId": "default-allow"
171
+ }
172
+ ```
173
+
174
+ #### Scenario B — Prompt injection attempt
175
+
176
+ ```json
177
+ {
178
+ "status": "BLOCK",
179
+ "reason": "Prompt injection detected: instruction override attempt"
180
+ }
181
+ ```
182
+
183
+ #### Scenario C — Destructive action
184
+
185
+ ```json
186
+ {
187
+ "status": "PAUSE",
188
+ "reason": "This action would remove files. Confirmation needed."
189
+ }
190
+ ```
191
+
192
+ > Tip: add screenshots or terminal captures from your own runs here so developers can see concrete behavior instantly.
193
+
194
+ ### Adoption Ladder (Start Small, Scale Safely)
195
+
196
+ 1. **Level 1 — Tool Firewall**
197
+ Wrap only high-risk tools (shell/network/delete) with guard checks.
198
+ 2. **Level 2 — Mission Governance**
199
+ Add plan enforcement to constrain actions to task scope.
200
+ 3. **Level 3 — Full World Governance**
201
+ Enable roles, guards, kernel rules, invariants, and strict enforcement.
202
+ 4. **Level 4 — Spatial + Multi-Actor Governance**
203
+ Add zone opt-in, handshake negotiation, and dynamic policy composition.
204
+
205
+ =======
206
+ >>>>>>> main
207
+ ---
208
+
20
209
  ## The Product: Three Screens
21
210
 
22
211
  NeuroVerse ships as a companion app. Three screens. That's the whole product.
@@ -1,4 +1,5 @@
1
- import { W as WorldDefinition, G as GuardEvent, a as GuardVerdict } from '../guard-contract-CLBbTGK_.cjs';
1
+ import { a as GuardEvent, G as GuardVerdict } from '../guard-contract-ddiIPlOg.cjs';
2
+ import { WorldDefinition } from '../types.cjs';
2
3
 
3
4
  /**
4
5
  * Autoresearch Adapter — Bridge between NeuroVerse governance and autoresearch loops
@@ -1,4 +1,5 @@
1
- import { W as WorldDefinition, G as GuardEvent, a as GuardVerdict } from '../guard-contract-CLBbTGK_.js';
1
+ import { a as GuardEvent, G as GuardVerdict } from '../guard-contract-q6HJAq3Q.js';
2
+ import { WorldDefinition } from '../types.js';
2
3
 
3
4
  /**
4
5
  * Autoresearch Adapter — Bridge between NeuroVerse governance and autoresearch loops
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  AutoresearchGovernor,
3
3
  createAutoresearchGovernor
4
- } from "../chunk-YNYCQECH.js";
4
+ } from "../chunk-TL4DLMMW.js";
5
+ import "../chunk-EQUAWNXW.js";
5
6
  import "../chunk-ZAF6JH23.js";
6
7
  import "../chunk-QLPTHTVB.js";
7
- import "../chunk-BXLTEUS4.js";
8
8
  import "../chunk-QWGCMQQD.js";
9
9
  export {
10
10
  AutoresearchGovernor,
@@ -1,5 +1,6 @@
1
- import { b as GuardEngineOptions, P as PlanDefinition, W as WorldDefinition, a as GuardVerdict, G as GuardEvent, c as PlanProgress } from '../guard-contract-CLBbTGK_.cjs';
2
- import { G as GovernanceBlockedError$1 } from '../shared-BGzmYP5g.cjs';
1
+ import { b as GuardEngineOptions, P as PlanDefinition, G as GuardVerdict, a as GuardEvent, c as PlanProgress } from '../guard-contract-ddiIPlOg.cjs';
2
+ import { WorldDefinition } from '../types.cjs';
3
+ import { G as GovernanceBlockedError$1 } from '../shared-PpalGKxc.cjs';
3
4
 
4
5
  /**
5
6
  * Centralized Tool Classification & Risk Pattern Detection
@@ -1,5 +1,6 @@
1
- import { b as GuardEngineOptions, P as PlanDefinition, W as WorldDefinition, a as GuardVerdict, G as GuardEvent, c as PlanProgress } from '../guard-contract-CLBbTGK_.js';
2
- import { G as GovernanceBlockedError$1 } from '../shared-CwGpPheR.js';
1
+ import { b as GuardEngineOptions, P as PlanDefinition, G as GuardVerdict, a as GuardEvent, c as PlanProgress } from '../guard-contract-q6HJAq3Q.js';
2
+ import { WorldDefinition } from '../types.js';
3
+ import { G as GovernanceBlockedError$1 } from '../shared-DAzdfWtU.js';
3
4
 
4
5
  /**
5
6
  * Centralized Tool Classification & Risk Pattern Detection
@@ -3,11 +3,11 @@ import {
3
3
  GovernanceBlockedError,
4
4
  createDeepAgentsGuard,
5
5
  createDeepAgentsGuardFromWorld
6
- } from "../chunk-DWHUZUEY.js";
6
+ } from "../chunk-5RAQ5DZW.js";
7
7
  import "../chunk-5U2MQO5P.js";
8
+ import "../chunk-EQUAWNXW.js";
8
9
  import "../chunk-ZAF6JH23.js";
9
10
  import "../chunk-QLPTHTVB.js";
10
- import "../chunk-BXLTEUS4.js";
11
11
  import "../chunk-QWGCMQQD.js";
12
12
  export {
13
13
  DeepAgentsGuard,
@@ -1,4 +1,5 @@
1
- import { a as GuardVerdict, G as GuardEvent, W as WorldDefinition } from '../guard-contract-CLBbTGK_.cjs';
1
+ import { G as GuardVerdict, a as GuardEvent } from '../guard-contract-ddiIPlOg.cjs';
2
+ import { WorldDefinition } from '../types.cjs';
2
3
 
3
4
  /**
4
5
  * NeuroVerse Adapter — Express / Fastify
@@ -1,4 +1,5 @@
1
- import { a as GuardVerdict, G as GuardEvent, W as WorldDefinition } from '../guard-contract-CLBbTGK_.js';
1
+ import { G as GuardVerdict, a as GuardEvent } from '../guard-contract-q6HJAq3Q.js';
2
+ import { WorldDefinition } from '../types.js';
2
3
 
3
4
  /**
4
5
  * NeuroVerse Adapter — Express / Fastify
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createGovernanceMiddleware,
3
3
  createGovernanceMiddlewareFromWorld
4
- } from "../chunk-25XHSTPT.js";
4
+ } from "../chunk-6UPEUMJ2.js";
5
+ import "../chunk-EQUAWNXW.js";
5
6
  import "../chunk-ZAF6JH23.js";
6
7
  import "../chunk-QLPTHTVB.js";
7
- import "../chunk-BXLTEUS4.js";
8
8
  import "../chunk-QWGCMQQD.js";
9
9
  export {
10
10
  createGovernanceMiddleware,