@neuroverseos/governance 0.3.0 → 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 +352 -237
- package/dist/adapters/autoresearch.cjs +1152 -3
- package/dist/adapters/autoresearch.d.cts +11 -3
- package/dist/adapters/autoresearch.d.ts +11 -3
- package/dist/adapters/autoresearch.js +9 -4
- 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 +171 -32
- package/dist/adapters/express.d.cts +1 -1
- package/dist/adapters/express.d.ts +1 -1
- package/dist/adapters/express.js +5 -5
- package/dist/adapters/index.cjs +564 -121
- package/dist/adapters/index.d.cts +3 -1
- package/dist/adapters/index.d.ts +3 -1
- package/dist/adapters/index.js +38 -16
- package/dist/adapters/langchain.cjs +217 -57
- package/dist/adapters/langchain.d.cts +5 -5
- package/dist/adapters/langchain.d.ts +5 -5
- package/dist/adapters/langchain.js +6 -5
- package/dist/adapters/openai.cjs +219 -59
- package/dist/adapters/openai.d.cts +5 -5
- package/dist/adapters/openai.d.ts +5 -5
- package/dist/adapters/openai.js +6 -5
- package/dist/adapters/openclaw.cjs +217 -57
- package/dist/adapters/openclaw.d.cts +6 -6
- package/dist/adapters/openclaw.d.ts +6 -6
- package/dist/adapters/openclaw.js +6 -5
- package/dist/add-ROOZLU62.js +314 -0
- package/dist/behavioral-MJO34S6Q.js +118 -0
- package/dist/{bootstrap-GXVDZNF7.js → bootstrap-CQRZVOXK.js} +6 -4
- 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-P42YFKQV.js → build-QKOBBC23.js} +7 -5
- package/dist/{chunk-COT5XS4V.js → chunk-3WQLXYTP.js} +17 -35
- package/dist/{chunk-ER62HNGF.js → chunk-4FLICVVA.js} +17 -37
- package/dist/chunk-5TPFNWRU.js +215 -0
- package/dist/chunk-5U2MQO5P.js +57 -0
- package/dist/{chunk-NF5POFCI.js → chunk-6S5CFQXY.js} +6 -4
- package/dist/{chunk-QPASI2BR.js → chunk-A7GKPPU7.js} +49 -10
- package/dist/{chunk-OGL7QXZS.js → chunk-B6OXJLJ5.js} +17 -3
- package/dist/{chunk-2PQU3VAN.js → chunk-BNKJPUPQ.js} +17 -35
- package/dist/chunk-BQZMOEML.js +43 -0
- package/dist/chunk-CNSO6XW5.js +207 -0
- package/dist/{chunk-JZPQGIKR.js → chunk-CTZHONLA.js} +65 -9
- package/dist/chunk-D2UCV5AK.js +326 -0
- package/dist/{chunk-XPDMYECO.js → chunk-EMQDLDAF.js} +1 -185
- package/dist/{chunk-GR6DGCZ2.js → chunk-F66BVUYB.js} +3 -3
- package/dist/{chunk-2NICNKOM.js → chunk-G7DJ6VOD.js} +5 -4
- package/dist/{chunk-4A7LISES.js → chunk-IS4WUH6Y.js} +45 -6
- package/dist/{chunk-MWDQ4MJB.js → chunk-MH7BT4VH.js} +5 -1
- package/dist/chunk-O5ABKEA7.js +304 -0
- package/dist/chunk-PVTQQS3Y.js +186 -0
- package/dist/{chunk-4QXB6PEO.js → chunk-QLPTHTVB.js} +37 -16
- package/dist/chunk-QWGCMQQD.js +16 -0
- package/dist/{chunk-T5EUJQE5.js → chunk-QXBFT7NI.js} +31 -2
- package/dist/{chunk-PDOZHZWL.js → chunk-TG6SEF24.js} +25 -4
- package/dist/chunk-U6U7EJZL.js +177 -0
- package/dist/{chunk-4JRYGIO7.js → chunk-W7LLXRGY.js} +110 -7
- package/dist/{chunk-BUWWN2NX.js → chunk-ZJTDUCC2.js} +9 -7
- package/dist/{chunk-FYS2CBUW.js → chunk-ZWI3NIXK.js} +10 -0
- package/dist/cli/neuroverse.cjs +5091 -2348
- package/dist/cli/neuroverse.js +52 -21
- package/dist/cli/plan.cjs +881 -41
- package/dist/cli/plan.js +7 -15
- package/dist/cli/run.cjs +289 -34
- package/dist/cli/run.js +4 -4
- package/dist/{configure-ai-TK67ZWZL.js → configure-ai-6TZ3MCSI.js} +1 -1
- package/dist/decision-flow-M63D47LO.js +61 -0
- package/dist/demo-G43RLCPK.js +469 -0
- package/dist/{derive-TLIV4OOU.js → derive-FJZVIPUZ.js} +5 -4
- package/dist/{doctor-XPDLEYXN.js → doctor-6BC6X2VO.js} +6 -4
- package/dist/equity-penalties-SG5IZQ7I.js +244 -0
- package/dist/{explain-IDCRWMPX.js → explain-RHBU2GBR.js} +6 -25
- package/dist/{guard-RV65TT4L.js → guard-AJCCGZMF.js} +8 -12
- package/dist/{guard-contract-WZx__PmU.d.cts → guard-contract-DqFcTScd.d.cts} +117 -5
- package/dist/{guard-contract-WZx__PmU.d.ts → guard-contract-DqFcTScd.d.ts} +117 -5
- package/dist/{guard-engine-JLTUARGU.js → guard-engine-PNR6MHCM.js} +3 -3
- package/dist/{impact-XPECYRLH.js → impact-3XVDSCBU.js} +5 -5
- package/dist/{improve-GPUBKTEA.js → improve-TQP4ECSY.js} +7 -26
- package/dist/index.cjs +5597 -4279
- package/dist/index.d.cts +597 -18
- package/dist/index.d.ts +597 -18
- package/dist/index.js +134 -41
- package/dist/{infer-world-7GVZWFX4.js → infer-world-IFXCACJ5.js} +1 -1
- package/dist/{init-PKPIYHYE.js → init-FYPV4SST.js} +1 -1
- package/dist/{init-world-VWMQZQC7.js → init-world-TI7ARHBT.js} +1 -1
- package/dist/mcp-server-5Y3ZM7TV.js +13 -0
- package/dist/{model-adapter-BB7G4MFI.js → model-adapter-VXEKB4LS.js} +1 -1
- package/dist/{playground-E664U4T6.js → playground-VZBNPPBO.js} +29 -19
- package/dist/{redteam-Z7WREJ44.js → redteam-MZPZD3EF.js} +4 -4
- 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-VDOYQFRO.js → simulate-LJXYBC6M.js} +8 -33
- package/dist/{test-OGXJK4QU.js → test-BOOR4A5F.js} +4 -4
- package/dist/{trace-JVF67VR3.js → trace-PKV4KX56.js} +4 -4
- package/dist/{validate-LLBWVPGV.js → validate-RALX7CZS.js} +2 -2
- package/dist/{validate-engine-UIABSIHD.js → validate-engine-7ZXFVGF2.js} +1 -1
- package/dist/viz/assets/index-B8SaeJZZ.js +23 -0
- package/dist/viz/index.html +23 -0
- package/dist/{world-LAXO6DOX.js → world-BIP4GZBZ.js} +9 -11
- package/dist/world-loader-Y6HMQH2D.js +13 -0
- package/dist/worlds/coding-agent.nv-world.md +211 -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 +30 -4
- package/policies/content-moderation-rules.txt +8 -0
- package/policies/marketing-rules.txt +8 -0
- package/policies/science-research-rules.txt +11 -0
- package/policies/social-media-rules.txt +7 -0
- package/policies/strict-rules.txt +8 -0
- package/policies/trading-rules.txt +8 -0
- package/simulate.html +1567 -0
- package/dist/chunk-YZFATT7X.js +0 -9
- package/dist/mcp-server-FPVSU32Z.js +0 -13
- package/dist/session-EKTRSR7C.js +0 -14
- package/dist/world-loader-HMPTOEA2.js +0 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as GuardEvent, W as WorldDefinition,
|
|
2
|
-
export { E as EvaluationTrace,
|
|
1
|
+
import { G as GuardEvent, W as WorldDefinition, b as GuardEngineOptions, a as GuardVerdict, P as PlanDefinition, S as StepEvidence, A as AdvanceResult, d as PlanVerdict, e as PlanCheck, c as PlanProgress, f as AgentBehaviorState, g as GuardStatus, C as Consequence, R as Reward, h as Guard, I as Invariant, i as Rule, V as ViabilityStatus } from './guard-contract-DqFcTScd.js';
|
|
2
|
+
export { E as EvaluationTrace, j as GUARD_EXIT_CODES, k as GuardCheck, l as GuardExitCode, m as IntentRecord, n as InvariantCheck, K as KernelRuleCheck, L as LevelCheck, o as PLAN_EXIT_CODES, p as PlanCompletionMode, q as PlanConstraint, r as PlanExitCode, s as PlanStatus, t as PlanStep, u as PrecedenceResolution, v as RoleCheck, w as SafetyCheck, x as VerdictEvidence } from './guard-contract-DqFcTScd.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Guard Engine — Deterministic Governance Evaluator
|
|
@@ -28,12 +28,6 @@ export { E as EvaluationTrace, f as GUARD_EXIT_CODES, g as GuardCheck, h as Guar
|
|
|
28
28
|
* - No hidden logic. Everything is in the world file or declared here.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
/**
|
|
32
|
-
* Evaluate a guard event against a world definition.
|
|
33
|
-
*
|
|
34
|
-
* This is the entire guard engine. One function. Deterministic.
|
|
35
|
-
* No class instantiation, no state, no side effects.
|
|
36
|
-
*/
|
|
37
31
|
declare function evaluateGuard(event: GuardEvent, world: WorldDefinition, options?: GuardEngineOptions): GuardVerdict;
|
|
38
32
|
/**
|
|
39
33
|
* Build a normalized allowlist key from a GuardEvent.
|
|
@@ -291,6 +285,14 @@ interface SessionState {
|
|
|
291
285
|
actionsBlocked: number;
|
|
292
286
|
/** Total actions paused. */
|
|
293
287
|
actionsPaused: number;
|
|
288
|
+
/** Total actions modified. */
|
|
289
|
+
actionsModified: number;
|
|
290
|
+
/** Total actions penalized. */
|
|
291
|
+
actionsPenalized: number;
|
|
292
|
+
/** Total actions rewarded. */
|
|
293
|
+
actionsRewarded: number;
|
|
294
|
+
/** Agent behavior states — tracks cooldowns, influence, rewards per agent. */
|
|
295
|
+
agentStates: Map<string, AgentBehaviorState>;
|
|
294
296
|
}
|
|
295
297
|
declare class SessionManager {
|
|
296
298
|
private config;
|
|
@@ -307,6 +309,15 @@ declare class SessionManager {
|
|
|
307
309
|
* Returns the verdict without executing anything.
|
|
308
310
|
*/
|
|
309
311
|
evaluate(event: GuardEvent): GuardVerdict;
|
|
312
|
+
/**
|
|
313
|
+
* Advance all agent states by one round.
|
|
314
|
+
* Call this at the end of each simulation round to decrement cooldowns.
|
|
315
|
+
*/
|
|
316
|
+
tickRound(): void;
|
|
317
|
+
/**
|
|
318
|
+
* Get the behavior state for a specific agent.
|
|
319
|
+
*/
|
|
320
|
+
getAgentState(agentId: string): AgentBehaviorState | undefined;
|
|
310
321
|
/**
|
|
311
322
|
* Evaluate and execute a tool call.
|
|
312
323
|
* Returns the execution result or block reason.
|
|
@@ -458,10 +469,27 @@ interface AuditEvent {
|
|
|
458
469
|
actor?: string;
|
|
459
470
|
direction?: 'input' | 'output';
|
|
460
471
|
/** The governance decision */
|
|
461
|
-
decision: 'ALLOW' | 'BLOCK' | 'PAUSE';
|
|
472
|
+
decision: 'ALLOW' | 'BLOCK' | 'PAUSE' | 'MODIFY' | 'PENALIZE' | 'REWARD' | 'NEUTRAL';
|
|
462
473
|
reason?: string;
|
|
463
474
|
ruleId?: string;
|
|
464
475
|
warning?: string;
|
|
476
|
+
/** Consequence applied (for PENALIZE decisions) */
|
|
477
|
+
consequence?: {
|
|
478
|
+
type: string;
|
|
479
|
+
rounds?: number;
|
|
480
|
+
magnitude?: number;
|
|
481
|
+
description: string;
|
|
482
|
+
};
|
|
483
|
+
/** Reward applied (for REWARD decisions) */
|
|
484
|
+
reward?: {
|
|
485
|
+
type: string;
|
|
486
|
+
rounds?: number;
|
|
487
|
+
magnitude?: number;
|
|
488
|
+
description: string;
|
|
489
|
+
};
|
|
490
|
+
/** Intent tracking — original vs final action */
|
|
491
|
+
originalIntent?: string;
|
|
492
|
+
finalAction?: string;
|
|
465
493
|
/** Which rules/guards matched */
|
|
466
494
|
guardsMatched: string[];
|
|
467
495
|
rulesMatched: string[];
|
|
@@ -483,6 +511,10 @@ interface AuditSummary {
|
|
|
483
511
|
allowed: number;
|
|
484
512
|
blocked: number;
|
|
485
513
|
paused: number;
|
|
514
|
+
modified: number;
|
|
515
|
+
penalized: number;
|
|
516
|
+
rewarded: number;
|
|
517
|
+
neutral: number;
|
|
486
518
|
/** Unique actors seen */
|
|
487
519
|
actors: string[];
|
|
488
520
|
/** Actions grouped by intent */
|
|
@@ -491,6 +523,8 @@ interface AuditSummary {
|
|
|
491
523
|
count: number;
|
|
492
524
|
blocked: number;
|
|
493
525
|
paused: number;
|
|
526
|
+
penalized: number;
|
|
527
|
+
rewarded: number;
|
|
494
528
|
}[];
|
|
495
529
|
/** Most frequently triggered rules */
|
|
496
530
|
topRules: {
|
|
@@ -500,6 +534,13 @@ interface AuditSummary {
|
|
|
500
534
|
/** Time range */
|
|
501
535
|
firstEvent: string;
|
|
502
536
|
lastEvent: string;
|
|
537
|
+
/** Behavioral economy summary */
|
|
538
|
+
behavioralEconomy: {
|
|
539
|
+
totalPenalties: number;
|
|
540
|
+
totalRewards: number;
|
|
541
|
+
netPressure: number;
|
|
542
|
+
redirectionRate: number;
|
|
543
|
+
};
|
|
503
544
|
}
|
|
504
545
|
/**
|
|
505
546
|
* Pluggable audit logger interface.
|
|
@@ -667,8 +708,14 @@ interface ImpactReport {
|
|
|
667
708
|
totalBlocked: number;
|
|
668
709
|
totalPaused: number;
|
|
669
710
|
totalAllowed: number;
|
|
670
|
-
|
|
711
|
+
totalModified: number;
|
|
712
|
+
totalPenalized: number;
|
|
713
|
+
totalRewarded: number;
|
|
714
|
+
totalNeutral: number;
|
|
715
|
+
/** Prevention rate: (blocked + paused + modified + penalized) / total */
|
|
671
716
|
preventionRate: number;
|
|
717
|
+
/** Redirection rate: everything not ALLOW/NEUTRAL */
|
|
718
|
+
redirectionRate: number;
|
|
672
719
|
/** Blocked actions grouped by category */
|
|
673
720
|
preventedByCategory: PreventionCategory[];
|
|
674
721
|
/** Top prevented intents */
|
|
@@ -724,12 +771,170 @@ declare function renderImpactReport(report: ImpactReport): string;
|
|
|
724
771
|
*/
|
|
725
772
|
declare function generateImpactReportFromFile(logPath: string): Promise<ImpactReport>;
|
|
726
773
|
|
|
774
|
+
/**
|
|
775
|
+
* Decision Flow Engine — Intent → Rule → Outcome Visualization
|
|
776
|
+
*
|
|
777
|
+
* This is the core of the behavioral governance visualization.
|
|
778
|
+
* It transforms audit events into a flow structure that shows:
|
|
779
|
+
*
|
|
780
|
+
* LEFT (Intent Pool) → CENTER (Rules) → RIGHT (Outcome Pool)
|
|
781
|
+
* What agents wanted What intercepted What actually happened
|
|
782
|
+
*
|
|
783
|
+
* The gap between intent and outcome = governance value.
|
|
784
|
+
*
|
|
785
|
+
* Key metric: "X% of agent intent was redirected by governance"
|
|
786
|
+
*
|
|
787
|
+
* INVARIANTS:
|
|
788
|
+
* - Pure function: audit events in, flow structure out.
|
|
789
|
+
* - No speculation — only reports on actual evaluated actions.
|
|
790
|
+
* - Every flow path is traceable to a specific audit event.
|
|
791
|
+
*/
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* A cluster of agents with the same intent.
|
|
795
|
+
*/
|
|
796
|
+
interface IntentCluster {
|
|
797
|
+
/** The original intent (e.g., "sell", "publish", "attack") */
|
|
798
|
+
intent: string;
|
|
799
|
+
/** Number of agents with this intent */
|
|
800
|
+
agentCount: number;
|
|
801
|
+
/** Intensity score (0-1) based on volume and risk */
|
|
802
|
+
intensity: number;
|
|
803
|
+
/** Individual agent IDs in this cluster */
|
|
804
|
+
agents: string[];
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* A rule that intercepted actions in the flow.
|
|
808
|
+
*/
|
|
809
|
+
interface RuleObstacle {
|
|
810
|
+
/** Rule/guard ID */
|
|
811
|
+
ruleId: string;
|
|
812
|
+
/** Human-readable label */
|
|
813
|
+
label: string;
|
|
814
|
+
/** How many actions this rule intercepted */
|
|
815
|
+
interceptCount: number;
|
|
816
|
+
/** Breakdown by enforcement type */
|
|
817
|
+
enforcements: {
|
|
818
|
+
blocked: number;
|
|
819
|
+
modified: number;
|
|
820
|
+
penalized: number;
|
|
821
|
+
paused: number;
|
|
822
|
+
rewarded: number;
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* An outcome cluster — what agents ended up doing.
|
|
827
|
+
*/
|
|
828
|
+
interface OutcomeCluster {
|
|
829
|
+
/** The enforcement type that produced this outcome */
|
|
830
|
+
enforcement: GuardStatus;
|
|
831
|
+
/** Number of agents with this outcome */
|
|
832
|
+
agentCount: number;
|
|
833
|
+
/** For MODIFY: what they were changed to */
|
|
834
|
+
modifiedTo?: string;
|
|
835
|
+
/** Agent IDs in this cluster */
|
|
836
|
+
agents: string[];
|
|
837
|
+
/** Visual style hint */
|
|
838
|
+
style: 'green' | 'yellow' | 'red' | 'gray' | 'blue' | 'white';
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* A single flow path from intent → rule → outcome.
|
|
842
|
+
*/
|
|
843
|
+
interface FlowPath {
|
|
844
|
+
/** Source intent */
|
|
845
|
+
intent: string;
|
|
846
|
+
/** Rule that intercepted (if any) */
|
|
847
|
+
ruleId?: string;
|
|
848
|
+
/** Resulting enforcement */
|
|
849
|
+
enforcement: GuardStatus;
|
|
850
|
+
/** Agent ID */
|
|
851
|
+
agentId: string;
|
|
852
|
+
/** Original action */
|
|
853
|
+
originalAction: string;
|
|
854
|
+
/** Final action */
|
|
855
|
+
finalAction: string;
|
|
856
|
+
/** Consequence applied (if PENALIZE) */
|
|
857
|
+
consequence?: Consequence;
|
|
858
|
+
/** Reward applied (if REWARD) */
|
|
859
|
+
reward?: Reward;
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* The complete Decision Flow — the visualization data structure.
|
|
863
|
+
*
|
|
864
|
+
* LEFT → CENTER → RIGHT
|
|
865
|
+
* Intents → Rules → Outcomes
|
|
866
|
+
*/
|
|
867
|
+
interface DecisionFlow {
|
|
868
|
+
/** Left column: intent clusters */
|
|
869
|
+
intents: IntentCluster[];
|
|
870
|
+
/** Center column: rule obstacles */
|
|
871
|
+
rules: RuleObstacle[];
|
|
872
|
+
/** Right column: outcome clusters */
|
|
873
|
+
outcomes: OutcomeCluster[];
|
|
874
|
+
/** Every individual flow path */
|
|
875
|
+
paths: FlowPath[];
|
|
876
|
+
/** Key metrics */
|
|
877
|
+
metrics: DecisionFlowMetrics;
|
|
878
|
+
/** Time window */
|
|
879
|
+
periodStart: string;
|
|
880
|
+
periodEnd: string;
|
|
881
|
+
worldName: string;
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* The headline metrics for the Decision Flow.
|
|
885
|
+
*/
|
|
886
|
+
interface DecisionFlowMetrics {
|
|
887
|
+
/** Total intents evaluated */
|
|
888
|
+
totalIntents: number;
|
|
889
|
+
/** How many were redirected (not ALLOW) */
|
|
890
|
+
totalRedirected: number;
|
|
891
|
+
/** Headline: "X% of agent intent was redirected by governance" */
|
|
892
|
+
redirectionRate: number;
|
|
893
|
+
/** Breakdown by enforcement type */
|
|
894
|
+
byEnforcement: Record<string, number>;
|
|
895
|
+
/** Total penalties applied */
|
|
896
|
+
totalPenalties: number;
|
|
897
|
+
/** Total rewards applied */
|
|
898
|
+
totalRewards: number;
|
|
899
|
+
/** Net behavioral pressure (rewards - penalties) */
|
|
900
|
+
netBehavioralPressure: number;
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* Generate a Decision Flow from audit events.
|
|
904
|
+
*
|
|
905
|
+
* This is the primary entry point — takes raw audit data and produces
|
|
906
|
+
* the complete visualization structure.
|
|
907
|
+
*/
|
|
908
|
+
declare function generateDecisionFlow(events: AuditEvent[]): DecisionFlow;
|
|
909
|
+
/**
|
|
910
|
+
* Create a fresh agent behavior state.
|
|
911
|
+
*/
|
|
912
|
+
declare function createAgentState(agentId: string): AgentBehaviorState;
|
|
913
|
+
/**
|
|
914
|
+
* Apply a consequence to an agent's behavior state.
|
|
915
|
+
* Returns the updated state (immutable — creates a new object).
|
|
916
|
+
*/
|
|
917
|
+
declare function applyConsequence(state: AgentBehaviorState, consequence: Consequence, ruleId: string): AgentBehaviorState;
|
|
918
|
+
/**
|
|
919
|
+
* Apply a reward to an agent's behavior state.
|
|
920
|
+
* Returns the updated state (immutable).
|
|
921
|
+
*/
|
|
922
|
+
declare function applyReward(state: AgentBehaviorState, reward: Reward, ruleId: string): AgentBehaviorState;
|
|
923
|
+
/**
|
|
924
|
+
* Advance all agent states by one round.
|
|
925
|
+
* Decrements cooldowns, applies time-based effects.
|
|
926
|
+
*/
|
|
927
|
+
declare function tickAgentStates(states: Map<string, AgentBehaviorState>): Map<string, AgentBehaviorState>;
|
|
928
|
+
/**
|
|
929
|
+
* Render a Decision Flow as human-readable text.
|
|
930
|
+
* This is what `neuroverse decision-flow` prints.
|
|
931
|
+
*/
|
|
932
|
+
declare function renderDecisionFlow(flow: DecisionFlow): string;
|
|
933
|
+
|
|
727
934
|
/**
|
|
728
935
|
* World Loader — Shared world file loading for CLI commands
|
|
729
936
|
*
|
|
730
|
-
* Loads a WorldDefinition from
|
|
731
|
-
* - A directory containing individual JSON files
|
|
732
|
-
* - (Future) A .nv-world.zip archive
|
|
937
|
+
* Loads a WorldDefinition from a directory containing individual JSON files.
|
|
733
938
|
*
|
|
734
939
|
* Used by: neuroverse guard, neuroverse validate, neuroverse init
|
|
735
940
|
* Not used by: neuroverse bootstrap (which produces world files, not consumes them)
|
|
@@ -744,7 +949,7 @@ declare function generateImpactReportFromFile(logPath: string): Promise<ImpactRe
|
|
|
744
949
|
*/
|
|
745
950
|
declare function loadWorldFromDirectory(dirPath: string): Promise<WorldDefinition>;
|
|
746
951
|
/**
|
|
747
|
-
* Load a world from a
|
|
952
|
+
* Load a world from a directory path.
|
|
748
953
|
*/
|
|
749
954
|
declare function loadWorld(worldPath: string): Promise<WorldDefinition>;
|
|
750
955
|
|
|
@@ -1285,6 +1490,103 @@ declare function emitWorldDefinition(parsed: ParsedWorld): {
|
|
|
1285
1490
|
issues: ParseIssue[];
|
|
1286
1491
|
};
|
|
1287
1492
|
|
|
1493
|
+
/**
|
|
1494
|
+
* Add Engine — Incremental Governance Authoring
|
|
1495
|
+
*
|
|
1496
|
+
* Appends guards, rules, or invariants to a compiled world directory.
|
|
1497
|
+
* Runs validation after every addition. Deterministic, no LLM calls.
|
|
1498
|
+
*
|
|
1499
|
+
* Three construct types map to user intent:
|
|
1500
|
+
* "Block X" → Guard (action control)
|
|
1501
|
+
* "If X happens → Y changes" → Rule (world evolution)
|
|
1502
|
+
* "X must always be true" → Invariant (hard constraint)
|
|
1503
|
+
*
|
|
1504
|
+
* Architecture:
|
|
1505
|
+
* addGuard() → append to guards.json → validate → report
|
|
1506
|
+
* addRule() → write rules/rule-NNN.json → validate → report
|
|
1507
|
+
* addInvariant() → append to invariants.json → validate → report
|
|
1508
|
+
*/
|
|
1509
|
+
|
|
1510
|
+
interface AddResult {
|
|
1511
|
+
/** What was added */
|
|
1512
|
+
type: 'guard' | 'rule' | 'invariant';
|
|
1513
|
+
/** The ID of the added construct */
|
|
1514
|
+
id: string;
|
|
1515
|
+
/** The file that was written */
|
|
1516
|
+
file: string;
|
|
1517
|
+
/** Whether validation passed after addition */
|
|
1518
|
+
valid: boolean;
|
|
1519
|
+
/** Validation findings (errors/warnings) introduced by this addition */
|
|
1520
|
+
findings: ValidateReport['findings'];
|
|
1521
|
+
/** The full object that was written */
|
|
1522
|
+
construct: Guard | Rule | Invariant;
|
|
1523
|
+
}
|
|
1524
|
+
interface AddGuardInput {
|
|
1525
|
+
/** Human-readable label (e.g., "Block dairy orders") */
|
|
1526
|
+
label: string;
|
|
1527
|
+
/** What enforcement to apply */
|
|
1528
|
+
enforcement: Guard['enforcement'];
|
|
1529
|
+
/** Intent patterns to match (e.g., ["order*dairy", "purchase*dairy"]) */
|
|
1530
|
+
intentPatterns: string[];
|
|
1531
|
+
/** Optional description */
|
|
1532
|
+
description?: string;
|
|
1533
|
+
/** Optional category override */
|
|
1534
|
+
category?: Guard['category'];
|
|
1535
|
+
/** Optional tool filter */
|
|
1536
|
+
appliesTo?: string[];
|
|
1537
|
+
/** Optional reason for block/pause */
|
|
1538
|
+
reason?: string;
|
|
1539
|
+
/** Optional invariant reference */
|
|
1540
|
+
invariantRef?: string;
|
|
1541
|
+
/** Optional explicit ID */
|
|
1542
|
+
id?: string;
|
|
1543
|
+
}
|
|
1544
|
+
declare function addGuard(worldDir: string, input: AddGuardInput): Promise<AddResult>;
|
|
1545
|
+
interface AddRuleInput {
|
|
1546
|
+
/** Human-readable label */
|
|
1547
|
+
label: string;
|
|
1548
|
+
/** Severity level */
|
|
1549
|
+
severity: Rule['severity'];
|
|
1550
|
+
/** Description of what this rule does */
|
|
1551
|
+
description?: string;
|
|
1552
|
+
/** Trigger conditions */
|
|
1553
|
+
triggers: Rule['triggers'];
|
|
1554
|
+
/** Effects when triggered */
|
|
1555
|
+
effects?: Rule['effects'];
|
|
1556
|
+
/** Optional collapse check */
|
|
1557
|
+
collapseCheck?: Rule['collapse_check'];
|
|
1558
|
+
/** Causal translation (human-readable explanation) */
|
|
1559
|
+
causalTranslation?: Rule['causal_translation'];
|
|
1560
|
+
/** Optional explicit ID */
|
|
1561
|
+
id?: string;
|
|
1562
|
+
}
|
|
1563
|
+
declare function addRule(worldDir: string, input: AddRuleInput): Promise<AddResult>;
|
|
1564
|
+
interface AddInvariantInput {
|
|
1565
|
+
/** Human-readable label (e.g., "Budget must never exceed 1000") */
|
|
1566
|
+
label: string;
|
|
1567
|
+
/** Enforcement type */
|
|
1568
|
+
enforcement?: Invariant['enforcement'];
|
|
1569
|
+
/** Optional explicit ID */
|
|
1570
|
+
id?: string;
|
|
1571
|
+
}
|
|
1572
|
+
declare function addInvariant(worldDir: string, input: AddInvariantInput): Promise<AddResult>;
|
|
1573
|
+
/**
|
|
1574
|
+
* Classify a natural-language intent into the correct construct type.
|
|
1575
|
+
* This is a simple deterministic classifier — no LLM required.
|
|
1576
|
+
*
|
|
1577
|
+
* Returns 'guard' | 'rule' | 'invariant' | 'ambiguous'
|
|
1578
|
+
*/
|
|
1579
|
+
type ConstructType = 'guard' | 'rule' | 'invariant' | 'ambiguous';
|
|
1580
|
+
declare function classifyIntent(text: string): ConstructType;
|
|
1581
|
+
/**
|
|
1582
|
+
* Parse a natural-language guard description into AddGuardInput.
|
|
1583
|
+
* Handles common patterns like:
|
|
1584
|
+
* "Block dairy orders"
|
|
1585
|
+
* "Pause if cost > 500"
|
|
1586
|
+
* "Warn on shell access"
|
|
1587
|
+
*/
|
|
1588
|
+
declare function parseGuardDescription(text: string): AddGuardInput;
|
|
1589
|
+
|
|
1288
1590
|
/**
|
|
1289
1591
|
* Derive Contract — AI-Assisted World Synthesis Types
|
|
1290
1592
|
*
|
|
@@ -1501,12 +1803,26 @@ declare function explainWorld(world: WorldDefinition): ExplainOutput;
|
|
|
1501
1803
|
declare function renderExplainText(output: ExplainOutput): string;
|
|
1502
1804
|
|
|
1503
1805
|
/**
|
|
1504
|
-
* Simulate Engine — Deterministic State Evolution
|
|
1806
|
+
* Simulate Engine — Deterministic State Evolution (Reference Simulator)
|
|
1505
1807
|
*
|
|
1506
1808
|
* Pure function: (world, options) → SimulationResult
|
|
1507
1809
|
*
|
|
1508
|
-
*
|
|
1509
|
-
*
|
|
1810
|
+
* This is NeuroVerse's REFERENCE SIMULATOR — one way to model how a world
|
|
1811
|
+
* evolves over time. It is NOT the governance engine.
|
|
1812
|
+
*
|
|
1813
|
+
* simulateWorld() ≠ evaluateGuard()
|
|
1814
|
+
*
|
|
1815
|
+
* evaluateGuard() — Runtime enforcement. Decides if an action is allowed.
|
|
1816
|
+
* Includes safety layer, role checks, plan enforcement,
|
|
1817
|
+
* kernel rules, level constraints. Use for governance.
|
|
1818
|
+
*
|
|
1819
|
+
* simulateWorld() — State evolution modeling. Evaluates rule triggers,
|
|
1820
|
+
* applies effects, tracks viability over N steps.
|
|
1821
|
+
* Use for scenario planning and what-if analysis.
|
|
1822
|
+
*
|
|
1823
|
+
* World files (.nv-world.md) are portable — they define rules, roles, and
|
|
1824
|
+
* constraints that can be consumed by any simulator or governance engine.
|
|
1825
|
+
* This simulator is a reference implementation, not the only interpreter.
|
|
1510
1826
|
*
|
|
1511
1827
|
* Supports:
|
|
1512
1828
|
* - Single-step evaluation (default)
|
|
@@ -1519,6 +1835,7 @@ declare function renderExplainText(output: ExplainOutput): string;
|
|
|
1519
1835
|
* - Deterministic: same world + same options → same result.
|
|
1520
1836
|
* - Zero network calls. Zero LLM calls. Zero async.
|
|
1521
1837
|
* - Every rule evaluation is recorded in the trace.
|
|
1838
|
+
* - World definition is REQUIRED — no world, no simulation.
|
|
1522
1839
|
*/
|
|
1523
1840
|
|
|
1524
1841
|
interface SimulateOptions {
|
|
@@ -1613,4 +1930,266 @@ interface ImprovementReport {
|
|
|
1613
1930
|
declare function improveWorld(world: WorldDefinition): ImprovementReport;
|
|
1614
1931
|
declare function renderImproveText(report: ImprovementReport): string;
|
|
1615
1932
|
|
|
1616
|
-
|
|
1933
|
+
/**
|
|
1934
|
+
* Runtime Types — Simple input types for HTTP/demo consumers
|
|
1935
|
+
*
|
|
1936
|
+
* These types are the "easy API" for code that doesn't load full world files.
|
|
1937
|
+
* The govern() bridge converts these into the guard engine's native types.
|
|
1938
|
+
*/
|
|
1939
|
+
/**
|
|
1940
|
+
* A plain-object description of an agent action.
|
|
1941
|
+
* This is what HTTP clients and Python simulations send.
|
|
1942
|
+
*/
|
|
1943
|
+
interface AgentAction {
|
|
1944
|
+
/** Agent or role identifier */
|
|
1945
|
+
agentId: string;
|
|
1946
|
+
/** Action type (e.g., "publish", "trade", "share", "cite") */
|
|
1947
|
+
type: string;
|
|
1948
|
+
/** Human-readable description of what the agent is doing */
|
|
1949
|
+
description: string;
|
|
1950
|
+
/** Action magnitude/intensity (0-1 scale) */
|
|
1951
|
+
magnitude?: number;
|
|
1952
|
+
/** Arbitrary context data */
|
|
1953
|
+
context?: Record<string, unknown>;
|
|
1954
|
+
}
|
|
1955
|
+
/**
|
|
1956
|
+
* Arbitrary key-value state passed alongside an action.
|
|
1957
|
+
* Used by the simulation bridge to provide environmental context.
|
|
1958
|
+
*/
|
|
1959
|
+
type WorldState = Record<string, unknown>;
|
|
1960
|
+
/**
|
|
1961
|
+
* Configuration for creating a governor instance.
|
|
1962
|
+
*/
|
|
1963
|
+
interface GovernorConfig {
|
|
1964
|
+
/** Path to a .nv-world.md or .nv-world.zip file */
|
|
1965
|
+
worldPath?: string;
|
|
1966
|
+
/** Enable evaluation trace in verdicts */
|
|
1967
|
+
trace?: boolean;
|
|
1968
|
+
/** Enforcement level override */
|
|
1969
|
+
level?: 'basic' | 'standard' | 'strict';
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
/**
|
|
1973
|
+
* Govern — Thin bridge from HTTP/demo consumers to the real guard engine.
|
|
1974
|
+
*
|
|
1975
|
+
* This is NOT a second engine. It is NOT a parser.
|
|
1976
|
+
* It converts AgentAction → GuardEvent, loads a world, and calls evaluateGuard().
|
|
1977
|
+
* That's it. Zero intelligence. Zero interpretation.
|
|
1978
|
+
*
|
|
1979
|
+
* Rule parsing belongs in `neuroverse add`. Evaluation belongs in guard-engine.ts.
|
|
1980
|
+
* This bridge just translates types and calls the real thing.
|
|
1981
|
+
*
|
|
1982
|
+
* Architecture:
|
|
1983
|
+
* [HTTP request] → govern(action, worldPath) → evaluateGuard(event, world) → GuardVerdict
|
|
1984
|
+
*/
|
|
1985
|
+
|
|
1986
|
+
/**
|
|
1987
|
+
* Convert an AgentAction (HTTP/demo format) → GuardEvent (engine format).
|
|
1988
|
+
* Pure mapping. No interpretation. No intelligence.
|
|
1989
|
+
*/
|
|
1990
|
+
declare function actionToGuardEvent(action: AgentAction): GuardEvent;
|
|
1991
|
+
/**
|
|
1992
|
+
* Evaluate a single action against a loaded world.
|
|
1993
|
+
*
|
|
1994
|
+
* This is the entire bridge. AgentAction in, GuardVerdict out.
|
|
1995
|
+
* Uses the same evaluateGuard() as `neuroverse guard`.
|
|
1996
|
+
*/
|
|
1997
|
+
declare function govern(action: AgentAction, world: WorldDefinition, options?: GuardEngineOptions): GuardVerdict;
|
|
1998
|
+
/**
|
|
1999
|
+
* A governor holds a loaded world and evaluates actions against it.
|
|
2000
|
+
* Used by the demo server to avoid re-loading the world on every request.
|
|
2001
|
+
*/
|
|
2002
|
+
interface Governor {
|
|
2003
|
+
/** Evaluate an action against the loaded world */
|
|
2004
|
+
evaluate(action: AgentAction): GuardVerdict;
|
|
2005
|
+
/** Reload the world from disk (call after rules change) */
|
|
2006
|
+
reload(): Promise<void>;
|
|
2007
|
+
/** The loaded world definition */
|
|
2008
|
+
readonly world: WorldDefinition;
|
|
2009
|
+
}
|
|
2010
|
+
/**
|
|
2011
|
+
* Create a governor instance that holds a loaded world.
|
|
2012
|
+
*
|
|
2013
|
+
* Usage:
|
|
2014
|
+
* const gov = await createGovernor({ worldPath: '/tmp/neuroverse-demo' });
|
|
2015
|
+
* const verdict = gov.evaluate(action);
|
|
2016
|
+
* // After rule changes:
|
|
2017
|
+
* await gov.reload();
|
|
2018
|
+
*/
|
|
2019
|
+
declare function createGovernor(config: GovernorConfig): Promise<Governor>;
|
|
2020
|
+
/**
|
|
2021
|
+
* Write a minimal world directory from plain-text rules.
|
|
2022
|
+
*
|
|
2023
|
+
* This is for the demo server: UI sends plain-text rules,
|
|
2024
|
+
* we write them as kernel forbidden_patterns, then load
|
|
2025
|
+
* the world through the normal loadWorld() path.
|
|
2026
|
+
*
|
|
2027
|
+
* NO interpretation. Each rule line becomes a kernel forbidden pattern.
|
|
2028
|
+
* The guard engine does the matching.
|
|
2029
|
+
*/
|
|
2030
|
+
declare function writeTempWorld(dir: string, policyLines: string[]): Promise<void>;
|
|
2031
|
+
|
|
2032
|
+
/**
|
|
2033
|
+
* Behavioral Contract — Types for the Behavioral Analysis Engine
|
|
2034
|
+
*
|
|
2035
|
+
* Extracted from behavioral-engine.ts so other modules (CLI, API, tests)
|
|
2036
|
+
* can depend on the contract without pulling in implementation.
|
|
2037
|
+
*
|
|
2038
|
+
* Types:
|
|
2039
|
+
* ActionCategory — Categories of agent actions for behavioral shift tracking
|
|
2040
|
+
* Adaptation — A classified behavioral adaptation (what an agent did instead)
|
|
2041
|
+
* BehavioralPattern — An emergent behavioral pattern detected across agents
|
|
2042
|
+
* NetworkContext — Network-level context for narrative generation
|
|
2043
|
+
*/
|
|
2044
|
+
|
|
2045
|
+
/** Categories of agent actions for behavioral shift tracking */
|
|
2046
|
+
type ActionCategory = 'amplifying' | 'passive' | 'engaging' | 'corrective' | 'transactional' | 'creative' | 'analytical' | 'unknown';
|
|
2047
|
+
/** A classified behavioral adaptation — what an agent did instead */
|
|
2048
|
+
interface Adaptation {
|
|
2049
|
+
/** Agent identifier */
|
|
2050
|
+
agentId: string;
|
|
2051
|
+
/** What the agent intended to do */
|
|
2052
|
+
intendedAction: string;
|
|
2053
|
+
/** What the agent actually did (after governance) */
|
|
2054
|
+
executedAction: string;
|
|
2055
|
+
/** Named behavioral shift category */
|
|
2056
|
+
shiftType: string;
|
|
2057
|
+
/** Governance status that caused the shift */
|
|
2058
|
+
verdict: GuardStatus;
|
|
2059
|
+
/** Rule that caused the shift */
|
|
2060
|
+
ruleId?: string;
|
|
2061
|
+
/** Human-readable reason */
|
|
2062
|
+
reason?: string;
|
|
2063
|
+
}
|
|
2064
|
+
/** An emergent behavioral pattern detected across multiple agents */
|
|
2065
|
+
interface BehavioralPattern {
|
|
2066
|
+
/** Pattern type identifier */
|
|
2067
|
+
type: string;
|
|
2068
|
+
/** Human-readable description */
|
|
2069
|
+
description: string;
|
|
2070
|
+
/** Pattern strength (0-1), based on fraction of agents affected */
|
|
2071
|
+
strength: number;
|
|
2072
|
+
/** Number of agents exhibiting this pattern */
|
|
2073
|
+
agentsAffected: number;
|
|
2074
|
+
}
|
|
2075
|
+
/** Network-level context for narrative generation */
|
|
2076
|
+
interface NetworkContext {
|
|
2077
|
+
mood?: string;
|
|
2078
|
+
misinfoLevel?: number;
|
|
2079
|
+
totalAgents?: number;
|
|
2080
|
+
totalActions?: number;
|
|
2081
|
+
[key: string]: unknown;
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
/**
|
|
2085
|
+
* Behavioral Analysis Engine — What Governance UNLOCKS
|
|
2086
|
+
*
|
|
2087
|
+
* This is the differentiator. Every governance system can tell you
|
|
2088
|
+
* what it blocked. Only NeuroVerse tells you:
|
|
2089
|
+
* - What agents did INSTEAD (adaptation classification)
|
|
2090
|
+
* - What patterns emerged COLLECTIVELY (behavioral detection)
|
|
2091
|
+
* - WHY it matters IN PROSE (narrative generation)
|
|
2092
|
+
*
|
|
2093
|
+
* "Governance is the engine — but we also always want to show people
|
|
2094
|
+
* the knowledge that constraining unlocks."
|
|
2095
|
+
*
|
|
2096
|
+
* Architecture:
|
|
2097
|
+
* GuardVerdict[] → classifyAdaptation() → Adaptation[]
|
|
2098
|
+
* Adaptation[] → detectBehavioralPatterns() → BehavioralPattern[]
|
|
2099
|
+
* Pattern[] → generateAdaptationNarrative() → string
|
|
2100
|
+
*
|
|
2101
|
+
* Pure functions. No network. No LLM. Deterministic.
|
|
2102
|
+
*/
|
|
2103
|
+
|
|
2104
|
+
/**
|
|
2105
|
+
* Classify what behavioral shift governance caused for a single agent action.
|
|
2106
|
+
*
|
|
2107
|
+
* Takes the original intent and the actual execution, returns a named shift.
|
|
2108
|
+
* Pure function. No side effects.
|
|
2109
|
+
*/
|
|
2110
|
+
declare function classifyAdaptation(intendedAction: string, executedAction: string): string;
|
|
2111
|
+
/**
|
|
2112
|
+
* Build an Adaptation from a GuardVerdict with intent tracking.
|
|
2113
|
+
* Uses the IntentRecord attached to the verdict (if present).
|
|
2114
|
+
*/
|
|
2115
|
+
declare function adaptationFromVerdict(agentId: string, intendedAction: string, executedAction: string, verdict: GuardVerdict): Adaptation;
|
|
2116
|
+
/**
|
|
2117
|
+
* Detect emergent collective patterns from a batch of adaptations.
|
|
2118
|
+
*
|
|
2119
|
+
* This is NOT just counting. It detects:
|
|
2120
|
+
* - Coordinated silence (many agents forced idle)
|
|
2121
|
+
* - Misinformation suppression (amplification specifically blocked)
|
|
2122
|
+
* - Constructive redirection (agents shifted to positive actions)
|
|
2123
|
+
* - High governance impact (large fraction of agents affected)
|
|
2124
|
+
* - Trading halt (transactional agents stopped)
|
|
2125
|
+
*
|
|
2126
|
+
* Pure function. Deterministic. Same inputs → same patterns.
|
|
2127
|
+
*/
|
|
2128
|
+
declare function detectBehavioralPatterns(adaptations: Adaptation[], totalAgents: number): BehavioralPattern[];
|
|
2129
|
+
/**
|
|
2130
|
+
* Generate a human-readable cause-effect narrative from patterns.
|
|
2131
|
+
*
|
|
2132
|
+
* This is the "money moment" — the prose explanation of what governance
|
|
2133
|
+
* caused to happen. Not a log. Not a report. A story.
|
|
2134
|
+
*
|
|
2135
|
+
* "5 agents went silent instead of amplifying. 3 redirected to fact-checking.
|
|
2136
|
+
* Network mood: polarized, misinfo level: 45%"
|
|
2137
|
+
*/
|
|
2138
|
+
declare function generateAdaptationNarrative(patterns: BehavioralPattern[], context?: NetworkContext): string;
|
|
2139
|
+
|
|
2140
|
+
/**
|
|
2141
|
+
* API Handlers — Server-side request handlers for the demo server.
|
|
2142
|
+
*
|
|
2143
|
+
* These are pure functions that handle HTTP request bodies and return
|
|
2144
|
+
* response objects. No HTTP framework dependency — just data in, data out.
|
|
2145
|
+
*
|
|
2146
|
+
* The demo server (src/cli/demo.ts) wires these to routes.
|
|
2147
|
+
*/
|
|
2148
|
+
declare function handleHealthCheck(): {
|
|
2149
|
+
status: string;
|
|
2150
|
+
engine: string;
|
|
2151
|
+
version: string;
|
|
2152
|
+
capabilities: string[];
|
|
2153
|
+
};
|
|
2154
|
+
declare function handleListPresets(policiesDir?: string): Promise<{
|
|
2155
|
+
presets: Array<{
|
|
2156
|
+
id: string;
|
|
2157
|
+
name: string;
|
|
2158
|
+
description: string;
|
|
2159
|
+
rules: string;
|
|
2160
|
+
}>;
|
|
2161
|
+
}>;
|
|
2162
|
+
/**
|
|
2163
|
+
* Run governed reasoning on a scenario.
|
|
2164
|
+
* Takes a scenario description + world path, evaluates through the guard engine.
|
|
2165
|
+
*/
|
|
2166
|
+
declare function handleReasonRequest(body: {
|
|
2167
|
+
scenario?: string;
|
|
2168
|
+
worldPath?: string;
|
|
2169
|
+
intent?: string;
|
|
2170
|
+
tool?: string;
|
|
2171
|
+
roleId?: string;
|
|
2172
|
+
}): Promise<Record<string, unknown>>;
|
|
2173
|
+
/**
|
|
2174
|
+
* Create a shareable scenario capsule — a self-contained snapshot
|
|
2175
|
+
* of a governance scenario that can be shared or replayed.
|
|
2176
|
+
*/
|
|
2177
|
+
declare function handleCreateCapsule(body: {
|
|
2178
|
+
scenario?: string;
|
|
2179
|
+
rules?: string[];
|
|
2180
|
+
events?: Array<{
|
|
2181
|
+
intent: string;
|
|
2182
|
+
tool?: string;
|
|
2183
|
+
}>;
|
|
2184
|
+
}): {
|
|
2185
|
+
capsuleId: string;
|
|
2186
|
+
scenario: string;
|
|
2187
|
+
rules: string[];
|
|
2188
|
+
events: Array<{
|
|
2189
|
+
intent: string;
|
|
2190
|
+
tool?: string;
|
|
2191
|
+
}>;
|
|
2192
|
+
createdAt: string;
|
|
2193
|
+
};
|
|
2194
|
+
|
|
2195
|
+
export { type AIProvider, type AIProviderConfig, type ActionCategory, type Adaptation, type AddGuardInput, type AddInvariantInput, type AddResult, type AddRuleInput, AdvanceResult, type AgentAction, AgentBehaviorState, type AppliedEffect, type AuditEvent, type AuditLogger, type AuditSummary, BOOTSTRAP_EXIT_CODES, type BehavioralPattern, type BootstrapExitCode, type BootstrapResult, CONFIGURE_AI_EXIT_CODES, type ChatMessage, type CollectedSource, CompositeAuditLogger, type Condition, type ConditionOperator, type ConditionResult, Consequence, ConsoleAuditLogger, type ConstructType, DERIVE_EXIT_CODES, type DecisionFlow, type DecisionFlowMetrics, type DeriveExitCode, type DeriveFinding, type DeriveResult, type ExplainOutput, FileAuditLogger, type FindingCategory, type FindingSeverity, type FlowPath, type FormatVerdictOptions, type GovernanceEngineOptions, type GovernanceHealth, type Governor, type GovernorConfig, GuardEngineOptions, GuardEvent, GuardStatus, GuardVerdict, type ImpactReport, type ImprovementReport, type IntentCluster, McpGovernanceServer, type McpServerConfig, ModelAdapter, type ModelConfig, type ModelResponse, type NetworkContext, type NormalizationSummary, type OutcomeCluster, PROVIDERS, type ParseIssue, type ParsedAssumptionProfile, type ParsedEffect, type ParsedFrontmatter, type ParsedGate, type ParsedInvariant, type ParsedOutcome, type ParsedRule, type ParsedStateVariable, type ParsedTrigger, type ParsedWorld, PlanCheck, PlanDefinition, type PlanParseResult, PlanProgress, PlanVerdict, type PreventionCategory, type ProviderPreset, Reward, type RuleEvaluation, type RuleObstacle, type SessionConfig, SessionManager, type SessionState, type SimulateOptions, type SimulationResult, type SimulationStep, StepEvidence, type Suggestion, type SuggestionCategory, type SuggestionPriority, type ToolCall, type ToolDefinition, VALIDATE_EXIT_CODES, type ValidateExitCode, type ValidateFinding, type ValidateReport, type ValidateSummary, type ValidationMode, type WorldInfo, type WorldState, actionToGuardEvent, adaptationFromVerdict, addGuard, addInvariant, addRule, advancePlan, applyConsequence, applyReward, buildPlanCheck, classifyAdaptation, classifyIntent, createAgentState, createGovernanceEngine, createGovernor, deriveWorld, describeActiveWorld, detectBehavioralPatterns, emitWorldDefinition, evaluateCondition, evaluateGuard, evaluatePlan, eventToAllowlistKey, explainWorld, extractWorldMarkdown, formatVerdict, formatVerdictOneLine, generateAdaptationNarrative, generateDecisionFlow, generateImpactReport, generateImpactReportFromFile, getActiveWorldName, getPlanProgress, govern, handleCreateCapsule, handleHealthCheck, handleListPresets, handleReasonRequest, improveWorld, listWorlds, loadWorld, loadWorldFromDirectory, normalizeWorldMarkdown, parseGuardDescription, parsePlanMarkdown, parseWorldMarkdown, readAuditLog, renderDecisionFlow, renderExplainText, renderImpactReport, renderImproveText, renderSimulateText, resolveProvider, resolveWorldPath, runInteractiveMode, runPipeMode, setActiveWorld, simulateWorld, summarizeAuditEvents, tickAgentStates, validateWorld, verdictToAuditEvent, writeTempWorld };
|