@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,89 @@
|
|
|
1
|
+
import { G as GuardEvent, a as GuardVerdict, b as GuardEngineOptions, P as PlanDefinition, W as WorldDefinition, c as PlanProgress } from '../guard-contract-DqFcTScd.cjs';
|
|
2
|
+
import { G as GovernanceBlockedError$1 } from '../shared-B8dvUUD8.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* NeuroVerse Adapter — LangChain
|
|
6
|
+
*
|
|
7
|
+
* Wraps the governance engine as a LangChain tool-calling middleware.
|
|
8
|
+
* Intercepts tool invocations and evaluates them against a world definition
|
|
9
|
+
* before allowing execution to proceed.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* import { createNeuroVerseCallbackHandler } from 'neuroverse-governance/adapters/langchain';
|
|
13
|
+
*
|
|
14
|
+
* const handler = await createNeuroVerseCallbackHandler('./world/', {
|
|
15
|
+
* onBlock: (verdict) => console.log('Blocked:', verdict.reason),
|
|
16
|
+
* onPause: (verdict) => requestHumanApproval(verdict),
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* const agent = new AgentExecutor({ ..., callbacks: [handler] });
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
interface NeuroVerseHandlerOptions {
|
|
23
|
+
/** Include full evaluation trace in verdicts. Default: false. */
|
|
24
|
+
trace?: boolean;
|
|
25
|
+
/** Enforcement level override. */
|
|
26
|
+
level?: 'basic' | 'standard' | 'strict';
|
|
27
|
+
/** Called when an action is blocked. */
|
|
28
|
+
onBlock?: (verdict: GuardVerdict, event: GuardEvent) => void;
|
|
29
|
+
/** Called when an action requires approval. Return true to allow. */
|
|
30
|
+
onPause?: (verdict: GuardVerdict, event: GuardEvent) => Promise<boolean> | boolean;
|
|
31
|
+
/** Called for every evaluation (logging hook). */
|
|
32
|
+
onEvaluate?: (verdict: GuardVerdict, event: GuardEvent) => void;
|
|
33
|
+
/** Map a tool call to a GuardEvent. Override for custom tool shapes. */
|
|
34
|
+
mapToolCall?: (toolName: string, toolInput: Record<string, unknown>) => GuardEvent;
|
|
35
|
+
/** Active plan overlay for task-scoped governance. */
|
|
36
|
+
plan?: PlanDefinition;
|
|
37
|
+
/** Called when plan progress changes. */
|
|
38
|
+
onPlanProgress?: (progress: PlanProgress) => void;
|
|
39
|
+
/** Called when all plan steps are completed. */
|
|
40
|
+
onPlanComplete?: () => void;
|
|
41
|
+
}
|
|
42
|
+
declare class GovernanceBlockedError extends GovernanceBlockedError$1 {
|
|
43
|
+
readonly event: GuardEvent;
|
|
44
|
+
constructor(verdict: GuardVerdict, event: GuardEvent);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A LangChain-compatible callback handler that evaluates tool calls
|
|
48
|
+
* against a NeuroVerse world definition.
|
|
49
|
+
*
|
|
50
|
+
* Implements the BaseCallbackHandler interface shape so it can be
|
|
51
|
+
* passed directly into LangChain's callbacks array.
|
|
52
|
+
*/
|
|
53
|
+
declare class NeuroVerseCallbackHandler {
|
|
54
|
+
readonly name = "NeuroVerseGovernance";
|
|
55
|
+
private world;
|
|
56
|
+
private options;
|
|
57
|
+
engineOptions: GuardEngineOptions;
|
|
58
|
+
private mapToolCall;
|
|
59
|
+
activePlan?: PlanDefinition;
|
|
60
|
+
constructor(world: WorldDefinition, options?: NeuroVerseHandlerOptions);
|
|
61
|
+
/**
|
|
62
|
+
* Called before a tool is executed.
|
|
63
|
+
* Evaluates the tool call against the governance world.
|
|
64
|
+
*
|
|
65
|
+
* @throws GovernanceBlockedError if the action is BLOCKED
|
|
66
|
+
* @throws GovernanceBlockedError if the action is PAUSED and onPause returns false
|
|
67
|
+
*/
|
|
68
|
+
handleToolStart(tool: {
|
|
69
|
+
name: string;
|
|
70
|
+
}, input: string): Promise<void>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Create a NeuroVerse callback handler from a world path.
|
|
74
|
+
*
|
|
75
|
+
* @param worldPath - Path to world directory or .nv-world.zip
|
|
76
|
+
* @param options - Handler configuration
|
|
77
|
+
* @returns A callback handler ready to plug into LangChain
|
|
78
|
+
*/
|
|
79
|
+
declare function createNeuroVerseCallbackHandler(worldPath: string, options?: NeuroVerseHandlerOptions): Promise<NeuroVerseCallbackHandler>;
|
|
80
|
+
/**
|
|
81
|
+
* Create a NeuroVerse callback handler from a pre-loaded world.
|
|
82
|
+
*
|
|
83
|
+
* @param world - A loaded WorldDefinition
|
|
84
|
+
* @param options - Handler configuration
|
|
85
|
+
* @returns A callback handler ready to plug into LangChain
|
|
86
|
+
*/
|
|
87
|
+
declare function createNeuroVerseCallbackHandlerFromWorld(world: WorldDefinition, options?: NeuroVerseHandlerOptions): NeuroVerseCallbackHandler;
|
|
88
|
+
|
|
89
|
+
export { GovernanceBlockedError, NeuroVerseCallbackHandler, type NeuroVerseHandlerOptions, createNeuroVerseCallbackHandler, createNeuroVerseCallbackHandlerFromWorld };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { G as GuardEvent, a as GuardVerdict, b as GuardEngineOptions, P as PlanDefinition, W as WorldDefinition, c as PlanProgress } from '../guard-contract-DqFcTScd.js';
|
|
2
|
+
import { G as GovernanceBlockedError$1 } from '../shared-Dr5Wiay8.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* NeuroVerse Adapter — LangChain
|
|
6
|
+
*
|
|
7
|
+
* Wraps the governance engine as a LangChain tool-calling middleware.
|
|
8
|
+
* Intercepts tool invocations and evaluates them against a world definition
|
|
9
|
+
* before allowing execution to proceed.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* import { createNeuroVerseCallbackHandler } from 'neuroverse-governance/adapters/langchain';
|
|
13
|
+
*
|
|
14
|
+
* const handler = await createNeuroVerseCallbackHandler('./world/', {
|
|
15
|
+
* onBlock: (verdict) => console.log('Blocked:', verdict.reason),
|
|
16
|
+
* onPause: (verdict) => requestHumanApproval(verdict),
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* const agent = new AgentExecutor({ ..., callbacks: [handler] });
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
interface NeuroVerseHandlerOptions {
|
|
23
|
+
/** Include full evaluation trace in verdicts. Default: false. */
|
|
24
|
+
trace?: boolean;
|
|
25
|
+
/** Enforcement level override. */
|
|
26
|
+
level?: 'basic' | 'standard' | 'strict';
|
|
27
|
+
/** Called when an action is blocked. */
|
|
28
|
+
onBlock?: (verdict: GuardVerdict, event: GuardEvent) => void;
|
|
29
|
+
/** Called when an action requires approval. Return true to allow. */
|
|
30
|
+
onPause?: (verdict: GuardVerdict, event: GuardEvent) => Promise<boolean> | boolean;
|
|
31
|
+
/** Called for every evaluation (logging hook). */
|
|
32
|
+
onEvaluate?: (verdict: GuardVerdict, event: GuardEvent) => void;
|
|
33
|
+
/** Map a tool call to a GuardEvent. Override for custom tool shapes. */
|
|
34
|
+
mapToolCall?: (toolName: string, toolInput: Record<string, unknown>) => GuardEvent;
|
|
35
|
+
/** Active plan overlay for task-scoped governance. */
|
|
36
|
+
plan?: PlanDefinition;
|
|
37
|
+
/** Called when plan progress changes. */
|
|
38
|
+
onPlanProgress?: (progress: PlanProgress) => void;
|
|
39
|
+
/** Called when all plan steps are completed. */
|
|
40
|
+
onPlanComplete?: () => void;
|
|
41
|
+
}
|
|
42
|
+
declare class GovernanceBlockedError extends GovernanceBlockedError$1 {
|
|
43
|
+
readonly event: GuardEvent;
|
|
44
|
+
constructor(verdict: GuardVerdict, event: GuardEvent);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A LangChain-compatible callback handler that evaluates tool calls
|
|
48
|
+
* against a NeuroVerse world definition.
|
|
49
|
+
*
|
|
50
|
+
* Implements the BaseCallbackHandler interface shape so it can be
|
|
51
|
+
* passed directly into LangChain's callbacks array.
|
|
52
|
+
*/
|
|
53
|
+
declare class NeuroVerseCallbackHandler {
|
|
54
|
+
readonly name = "NeuroVerseGovernance";
|
|
55
|
+
private world;
|
|
56
|
+
private options;
|
|
57
|
+
engineOptions: GuardEngineOptions;
|
|
58
|
+
private mapToolCall;
|
|
59
|
+
activePlan?: PlanDefinition;
|
|
60
|
+
constructor(world: WorldDefinition, options?: NeuroVerseHandlerOptions);
|
|
61
|
+
/**
|
|
62
|
+
* Called before a tool is executed.
|
|
63
|
+
* Evaluates the tool call against the governance world.
|
|
64
|
+
*
|
|
65
|
+
* @throws GovernanceBlockedError if the action is BLOCKED
|
|
66
|
+
* @throws GovernanceBlockedError if the action is PAUSED and onPause returns false
|
|
67
|
+
*/
|
|
68
|
+
handleToolStart(tool: {
|
|
69
|
+
name: string;
|
|
70
|
+
}, input: string): Promise<void>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Create a NeuroVerse callback handler from a world path.
|
|
74
|
+
*
|
|
75
|
+
* @param worldPath - Path to world directory or .nv-world.zip
|
|
76
|
+
* @param options - Handler configuration
|
|
77
|
+
* @returns A callback handler ready to plug into LangChain
|
|
78
|
+
*/
|
|
79
|
+
declare function createNeuroVerseCallbackHandler(worldPath: string, options?: NeuroVerseHandlerOptions): Promise<NeuroVerseCallbackHandler>;
|
|
80
|
+
/**
|
|
81
|
+
* Create a NeuroVerse callback handler from a pre-loaded world.
|
|
82
|
+
*
|
|
83
|
+
* @param world - A loaded WorldDefinition
|
|
84
|
+
* @param options - Handler configuration
|
|
85
|
+
* @returns A callback handler ready to plug into LangChain
|
|
86
|
+
*/
|
|
87
|
+
declare function createNeuroVerseCallbackHandlerFromWorld(world: WorldDefinition, options?: NeuroVerseHandlerOptions): NeuroVerseCallbackHandler;
|
|
88
|
+
|
|
89
|
+
export { GovernanceBlockedError, NeuroVerseCallbackHandler, type NeuroVerseHandlerOptions, createNeuroVerseCallbackHandler, createNeuroVerseCallbackHandlerFromWorld };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GovernanceBlockedError,
|
|
3
|
+
NeuroVerseCallbackHandler,
|
|
4
|
+
createNeuroVerseCallbackHandler,
|
|
5
|
+
createNeuroVerseCallbackHandlerFromWorld
|
|
6
|
+
} from "../chunk-3WQLXYTP.js";
|
|
7
|
+
import "../chunk-5U2MQO5P.js";
|
|
8
|
+
import "../chunk-W7LLXRGY.js";
|
|
9
|
+
import "../chunk-QLPTHTVB.js";
|
|
10
|
+
import "../chunk-CTZHONLA.js";
|
|
11
|
+
import "../chunk-QWGCMQQD.js";
|
|
12
|
+
export {
|
|
13
|
+
GovernanceBlockedError,
|
|
14
|
+
NeuroVerseCallbackHandler,
|
|
15
|
+
createNeuroVerseCallbackHandler,
|
|
16
|
+
createNeuroVerseCallbackHandlerFromWorld
|
|
17
|
+
};
|