@neuroverseos/governance 0.2.1 → 0.2.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 +26 -0
- package/.well-known/mcp.json +68 -0
- package/AGENTS.md +219 -0
- package/README.md +84 -4
- package/dist/adapters/autoresearch.cjs +196 -0
- package/dist/adapters/autoresearch.d.cts +103 -0
- package/dist/adapters/autoresearch.d.ts +103 -0
- package/dist/adapters/autoresearch.js +7 -0
- package/dist/adapters/deep-agents.cjs +1472 -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 +103 -21
- package/dist/adapters/express.d.cts +1 -1
- package/dist/adapters/express.d.ts +1 -1
- package/dist/adapters/express.js +3 -3
- package/dist/adapters/index.cjs +678 -102
- package/dist/adapters/index.d.cts +4 -1
- package/dist/adapters/index.d.ts +4 -1
- package/dist/adapters/index.js +39 -13
- package/dist/adapters/langchain.cjs +181 -47
- package/dist/adapters/langchain.d.cts +5 -5
- package/dist/adapters/langchain.d.ts +5 -5
- package/dist/adapters/langchain.js +4 -3
- package/dist/adapters/openai.cjs +183 -49
- package/dist/adapters/openai.d.cts +5 -5
- package/dist/adapters/openai.d.ts +5 -5
- package/dist/adapters/openai.js +4 -3
- package/dist/adapters/openclaw.cjs +181 -47
- package/dist/adapters/openclaw.d.cts +5 -5
- package/dist/adapters/openclaw.d.ts +5 -5
- package/dist/adapters/openclaw.js +4 -3
- package/dist/{build-P42YFKQV.js → build-X5MZY4IA.js} +2 -2
- package/dist/{chunk-ZL4AHY4X.js → chunk-4L6OPKMQ.js} +1 -1
- package/dist/chunk-5U2MQO5P.js +57 -0
- package/dist/{chunk-UPJNTSVM.js → chunk-6BB55YJI.js} +16 -31
- package/dist/{chunk-37JG24WH.js → chunk-6CZSKEY5.js} +3 -0
- package/dist/{chunk-5EDDNJU6.js → chunk-AF2VX4AL.js} +52 -10
- package/dist/chunk-BQZMOEML.js +43 -0
- package/dist/chunk-D2UCV5AK.js +326 -0
- package/dist/{chunk-IVPKFJX3.js → chunk-EVDJUSZ2.js} +16 -31
- package/dist/{chunk-PQBJBVSW.js → chunk-IZSO75NZ.js} +72 -7
- package/dist/chunk-JCKSW2PZ.js +304 -0
- package/dist/{chunk-ADV7Q2LJ.js → chunk-KTFTTLTP.js} +25 -4
- package/dist/{chunk-MWDQ4MJB.js → chunk-MH7BT4VH.js} +5 -1
- package/dist/{chunk-P74Y66ZV.js → chunk-QLPTHTVB.js} +66 -18
- package/dist/{chunk-2JQJ5U5X.js → chunk-REXY4LUL.js} +49 -10
- package/dist/chunk-T5EUJQE5.js +172 -0
- package/dist/{chunk-PAX2P6ZP.js → chunk-TTBKTF3P.js} +15 -8
- package/dist/{chunk-TINSRYXQ.js → chunk-ZIVQNSZU.js} +16 -33
- package/dist/{chunk-BUWWN2NX.js → chunk-ZJTDUCC2.js} +9 -7
- package/dist/cli/neuroverse.cjs +2648 -495
- package/dist/cli/neuroverse.js +39 -15
- package/dist/cli/plan.cjs +178 -46
- package/dist/cli/plan.js +33 -26
- package/dist/cli/run.cjs +257 -28
- package/dist/cli/run.js +2 -2
- package/dist/decision-flow-LETV5NWY.js +61 -0
- package/dist/{derive-TLIV4OOU.js → derive-7365SUFU.js} +2 -2
- package/dist/{doctor-V72UM2TC.js → doctor-QYISMKEL.js} +5 -2
- package/dist/equity-penalties-63FGB3I2.js +244 -0
- package/dist/{explain-IDCRWMPX.js → explain-A2EWI2OL.js} +4 -23
- package/dist/{guard-WA3FCCIO.js → guard-3BWL3IGH.js} +6 -10
- package/dist/{guard-contract-D-2LQInm.d.ts → guard-contract-C9_zKbzd.d.cts} +155 -5
- package/dist/{guard-contract-D-2LQInm.d.cts → guard-contract-C9_zKbzd.d.ts} +155 -5
- package/dist/{guard-engine-D7X4CVAE.js → guard-engine-QFMIBWJY.js} +2 -2
- package/dist/{impact-BWULZ5RP.js → impact-UB6DXKSX.js} +4 -4
- package/dist/{improve-GPUBKTEA.js → improve-XZA57GER.js} +5 -24
- package/dist/index.cjs +639 -51
- package/dist/index.d.cts +235 -7
- package/dist/index.d.ts +235 -7
- package/dist/index.js +92 -41
- package/dist/infer-world-7GVZWFX4.js +543 -0
- package/dist/init-world-VWMQZQC7.js +223 -0
- package/dist/{mcp-server-YUOQP4M5.js → mcp-server-XWQZXNW7.js} +3 -3
- package/dist/{playground-CBXMAW2B.js → playground-ADWZORNV.js} +2 -2
- package/dist/{redteam-SSNABQ7W.js → redteam-JRQ7FD2F.js} +2 -2
- package/dist/{session-MWRBTCYX.js → session-MMYX5YCF.js} +4 -3
- package/dist/shared--Q8wPBVN.d.ts +60 -0
- package/dist/shared-HpAG90PX.d.cts +60 -0
- package/dist/shared-U2QFV7JH.js +16 -0
- package/dist/{simulate-VDOYQFRO.js → simulate-GMIFFXYV.js} +5 -30
- package/dist/{test-3GZSG5FR.js → test-JBBZ65X4.js} +2 -2
- package/dist/{trace-TM4Z7G73.js → trace-3MYWIDEF.js} +3 -3
- package/dist/worlds/autoresearch.nv-world.md +230 -0
- package/dist/worlds/coding-agent.nv-world.md +211 -0
- package/llms.txt +79 -0
- package/openapi.yaml +230 -0
- package/package.json +26 -4
- package/dist/{chunk-GR6DGCZ2.js → chunk-BMOXICAB.js} +3 -3
- package/dist/{chunk-NF5POFCI.js → chunk-ORJ3NOE6.js} +3 -3
- package/dist/{world-LAXO6DOX.js → world-BFJCIQSH.js} +3 -3
|
@@ -249,7 +249,7 @@ interface Guard {
|
|
|
249
249
|
label: string;
|
|
250
250
|
description: string;
|
|
251
251
|
category: 'structural' | 'operational' | 'advisory';
|
|
252
|
-
enforcement: 'block' | 'pause' | 'warn';
|
|
252
|
+
enforcement: 'block' | 'pause' | 'warn' | 'modify' | 'penalize' | 'reward' | 'neutral';
|
|
253
253
|
immutable: boolean;
|
|
254
254
|
invariant_ref?: string;
|
|
255
255
|
intent_patterns: string[];
|
|
@@ -261,8 +261,24 @@ interface Guard {
|
|
|
261
261
|
player_modes?: {
|
|
262
262
|
thinking?: 'annotate' | 'block' | 'ignore';
|
|
263
263
|
experience?: 'simulate' | 'score' | 'ignore';
|
|
264
|
-
action?: 'block' | 'pause' | 'warn';
|
|
264
|
+
action?: 'block' | 'pause' | 'warn' | 'modify' | 'penalize' | 'reward' | 'neutral';
|
|
265
265
|
};
|
|
266
|
+
/** Consequence to apply when enforcement is 'penalize' */
|
|
267
|
+
consequence?: {
|
|
268
|
+
type: 'freeze' | 'reduce_influence' | 'increase_risk' | 'cooldown' | 'custom';
|
|
269
|
+
rounds?: number;
|
|
270
|
+
magnitude?: number;
|
|
271
|
+
description: string;
|
|
272
|
+
};
|
|
273
|
+
/** Reward to apply when enforcement is 'reward' */
|
|
274
|
+
reward?: {
|
|
275
|
+
type: 'boost_influence' | 'priority' | 'faster_execution' | 'weight_increase' | 'custom';
|
|
276
|
+
rounds?: number;
|
|
277
|
+
magnitude?: number;
|
|
278
|
+
description: string;
|
|
279
|
+
};
|
|
280
|
+
/** For 'modify' enforcement: what the action should be changed to */
|
|
281
|
+
modify_to?: string;
|
|
266
282
|
}
|
|
267
283
|
interface IntentPattern {
|
|
268
284
|
label: string;
|
|
@@ -340,6 +356,38 @@ interface PlanConstraint {
|
|
|
340
356
|
/** Pattern that activates this constraint. */
|
|
341
357
|
trigger?: string;
|
|
342
358
|
}
|
|
359
|
+
/**
|
|
360
|
+
* How step completion is determined:
|
|
361
|
+
* - 'trust' — caller asserts completion, plan advances (default)
|
|
362
|
+
* - 'verified' — steps with a `verify` field require evidence to advance;
|
|
363
|
+
* steps without `verify` still advance on trust
|
|
364
|
+
*/
|
|
365
|
+
type PlanCompletionMode = 'trust' | 'verified';
|
|
366
|
+
/**
|
|
367
|
+
* Evidence provided when advancing a step in verified mode.
|
|
368
|
+
* The verifier checks that evidence.type matches step.verify.
|
|
369
|
+
*/
|
|
370
|
+
interface StepEvidence {
|
|
371
|
+
/** Evidence type — must match the step's `verify` field. */
|
|
372
|
+
type: string;
|
|
373
|
+
/** Proof payload (URL, hash, output snippet, etc.). */
|
|
374
|
+
proof: string;
|
|
375
|
+
/** When the evidence was produced. */
|
|
376
|
+
timestamp?: string;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Result of attempting to advance a step.
|
|
380
|
+
*/
|
|
381
|
+
interface AdvanceResult {
|
|
382
|
+
/** Whether the step was successfully advanced. */
|
|
383
|
+
success: boolean;
|
|
384
|
+
/** Updated plan (if success). */
|
|
385
|
+
plan?: PlanDefinition;
|
|
386
|
+
/** Why advancement failed (if !success). */
|
|
387
|
+
reason?: string;
|
|
388
|
+
/** The evidence that was accepted (if verified mode). */
|
|
389
|
+
evidence?: StepEvidence;
|
|
390
|
+
}
|
|
343
391
|
interface PlanDefinition {
|
|
344
392
|
/** Unique plan identifier. */
|
|
345
393
|
plan_id: string;
|
|
@@ -347,6 +395,12 @@ interface PlanDefinition {
|
|
|
347
395
|
objective: string;
|
|
348
396
|
/** Whether steps must run in order. */
|
|
349
397
|
sequential: boolean;
|
|
398
|
+
/**
|
|
399
|
+
* How step completion is determined.
|
|
400
|
+
* - 'trust' (default) — caller asserts "done", plan advances
|
|
401
|
+
* - 'verified' — steps with `verify` require evidence to advance
|
|
402
|
+
*/
|
|
403
|
+
completion: PlanCompletionMode;
|
|
350
404
|
/** The steps in this plan. */
|
|
351
405
|
steps: PlanStep[];
|
|
352
406
|
/** Constraints that apply to this plan. */
|
|
@@ -483,7 +537,87 @@ interface GuardEvent {
|
|
|
483
537
|
/** Environment context (e.g. "development", "production") */
|
|
484
538
|
environment?: string;
|
|
485
539
|
}
|
|
486
|
-
type GuardStatus = 'ALLOW' | 'BLOCK' | 'PAUSE';
|
|
540
|
+
type GuardStatus = 'ALLOW' | 'BLOCK' | 'PAUSE' | 'MODIFY' | 'PENALIZE' | 'REWARD' | 'NEUTRAL';
|
|
541
|
+
/**
|
|
542
|
+
* Consequence applied when an agent is PENALIZED.
|
|
543
|
+
* The governance engine blocks the action AND imposes a behavioral cost.
|
|
544
|
+
*/
|
|
545
|
+
interface Consequence {
|
|
546
|
+
/** Type of penalty */
|
|
547
|
+
type: 'freeze' | 'reduce_influence' | 'increase_risk' | 'cooldown' | 'custom';
|
|
548
|
+
/** Duration in rounds (for freeze/cooldown) */
|
|
549
|
+
rounds?: number;
|
|
550
|
+
/** Magnitude of effect (e.g., influence reduction percentage 0-1) */
|
|
551
|
+
magnitude?: number;
|
|
552
|
+
/** Human-readable description of what happens */
|
|
553
|
+
description: string;
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Reward applied when an agent's action is REWARDED.
|
|
557
|
+
* The action proceeds AND the agent receives a behavioral boost.
|
|
558
|
+
*/
|
|
559
|
+
interface Reward {
|
|
560
|
+
/** Type of reward */
|
|
561
|
+
type: 'boost_influence' | 'priority' | 'faster_execution' | 'weight_increase' | 'custom';
|
|
562
|
+
/** Duration in rounds (for temporary boosts) */
|
|
563
|
+
rounds?: number;
|
|
564
|
+
/** Magnitude of effect (e.g., influence boost percentage 0-1) */
|
|
565
|
+
magnitude?: number;
|
|
566
|
+
/** Human-readable description of what happens */
|
|
567
|
+
description: string;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Tracks the behavioral state of an agent across governance evaluations.
|
|
571
|
+
* This is what makes governance a behavior-shaping system, not just a filter.
|
|
572
|
+
*/
|
|
573
|
+
interface AgentBehaviorState {
|
|
574
|
+
/** Agent/role identifier */
|
|
575
|
+
agentId: string;
|
|
576
|
+
/** Rounds remaining in cooldown (0 = active) */
|
|
577
|
+
cooldownRemaining: number;
|
|
578
|
+
/** Current influence multiplier (1.0 = normal) */
|
|
579
|
+
influence: number;
|
|
580
|
+
/** Accumulated reward multiplier (1.0 = normal) */
|
|
581
|
+
rewardMultiplier: number;
|
|
582
|
+
/** Total penalties received */
|
|
583
|
+
totalPenalties: number;
|
|
584
|
+
/** Total rewards received */
|
|
585
|
+
totalRewards: number;
|
|
586
|
+
/** History of consequences applied */
|
|
587
|
+
consequenceHistory: Array<{
|
|
588
|
+
ruleId: string;
|
|
589
|
+
consequence: Consequence;
|
|
590
|
+
appliedAt: number;
|
|
591
|
+
}>;
|
|
592
|
+
/** History of rewards applied */
|
|
593
|
+
rewardHistory: Array<{
|
|
594
|
+
ruleId: string;
|
|
595
|
+
reward: Reward;
|
|
596
|
+
appliedAt: number;
|
|
597
|
+
}>;
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Tracks what an agent WANTED to do vs what governance MADE it do.
|
|
601
|
+
* This is the core of the Decision Flow visualization.
|
|
602
|
+
*
|
|
603
|
+
* The gap between intent and outcome = governance value.
|
|
604
|
+
*/
|
|
605
|
+
interface IntentRecord {
|
|
606
|
+
/** Original action the agent attempted */
|
|
607
|
+
originalIntent: string;
|
|
608
|
+
/** What actually happened after governance */
|
|
609
|
+
finalAction: string;
|
|
610
|
+
/** The rule that caused the interception */
|
|
611
|
+
ruleApplied?: string;
|
|
612
|
+
/** How the intent was transformed */
|
|
613
|
+
enforcement: GuardStatus;
|
|
614
|
+
/** If MODIFY, what the action was changed to */
|
|
615
|
+
modifiedTo?: string;
|
|
616
|
+
/** If PENALIZE, the consequence applied */
|
|
617
|
+
consequence?: Consequence;
|
|
618
|
+
/** If REWARD, the reward applied */
|
|
619
|
+
reward?: Reward;
|
|
620
|
+
}
|
|
487
621
|
/**
|
|
488
622
|
* Evidence attached to every verdict for audit purposes.
|
|
489
623
|
* Always present, regardless of trace mode.
|
|
@@ -523,6 +657,12 @@ interface GuardVerdict {
|
|
|
523
657
|
ruleId?: string;
|
|
524
658
|
/** Advisory warning (for ALLOW with warn-mode guards) */
|
|
525
659
|
warning?: string;
|
|
660
|
+
/** Consequence applied (for PENALIZE verdicts) */
|
|
661
|
+
consequence?: Consequence;
|
|
662
|
+
/** Reward applied (for REWARD verdicts) */
|
|
663
|
+
reward?: Reward;
|
|
664
|
+
/** Intent tracking — what the agent wanted vs what happened */
|
|
665
|
+
intentRecord?: IntentRecord;
|
|
526
666
|
/** Audit evidence — always present */
|
|
527
667
|
evidence: VerdictEvidence;
|
|
528
668
|
/** Evaluation trace — present when trace mode is enabled */
|
|
@@ -595,7 +735,7 @@ interface GuardCheck {
|
|
|
595
735
|
category: 'structural' | 'operational' | 'advisory';
|
|
596
736
|
enabled: boolean;
|
|
597
737
|
matched: boolean;
|
|
598
|
-
enforcement: 'block' | 'pause' | 'warn';
|
|
738
|
+
enforcement: 'block' | 'pause' | 'warn' | 'modify' | 'penalize' | 'reward' | 'neutral';
|
|
599
739
|
/** Which intent patterns matched (if any) */
|
|
600
740
|
matchedPatterns: string[];
|
|
601
741
|
/** Whether the guard was skipped due to role gating */
|
|
@@ -659,13 +799,23 @@ interface GuardEngineOptions {
|
|
|
659
799
|
* Plans can only restrict, never expand.
|
|
660
800
|
*/
|
|
661
801
|
plan?: PlanDefinition;
|
|
802
|
+
/**
|
|
803
|
+
* Agent behavior states — tracks cooldowns, influence, rewards per agent.
|
|
804
|
+
* The engine reads this to check if an agent is penalized (frozen).
|
|
805
|
+
* The caller owns mutation (applying consequences/rewards after verdict).
|
|
806
|
+
*/
|
|
807
|
+
agentStates?: Map<string, AgentBehaviorState>;
|
|
662
808
|
}
|
|
663
809
|
declare const GUARD_EXIT_CODES: {
|
|
664
810
|
readonly ALLOW: 0;
|
|
665
811
|
readonly BLOCK: 1;
|
|
666
812
|
readonly PAUSE: 2;
|
|
667
813
|
readonly ERROR: 3;
|
|
814
|
+
readonly MODIFY: 4;
|
|
815
|
+
readonly PENALIZE: 5;
|
|
816
|
+
readonly REWARD: 6;
|
|
817
|
+
readonly NEUTRAL: 7;
|
|
668
818
|
};
|
|
669
819
|
type GuardExitCode = (typeof GUARD_EXIT_CODES)[keyof typeof GUARD_EXIT_CODES];
|
|
670
820
|
|
|
671
|
-
export { type EvaluationTrace as E, type
|
|
821
|
+
export { type AdvanceResult as A, type Consequence as C, type EvaluationTrace as E, type GuardEvent as G, type IntentRecord as I, type KernelRuleCheck as K, type LevelCheck as L, type PlanDefinition as P, type Reward as R, type StepEvidence as S, type ViabilityStatus as V, type WorldDefinition as W, type GuardVerdict as a, type GuardEngineOptions as b, type PlanProgress as c, type PlanVerdict as d, type PlanCheck as e, type AgentBehaviorState as f, type GuardStatus as g, GUARD_EXIT_CODES as h, type GuardCheck as i, type GuardExitCode as j, type InvariantCheck as k, PLAN_EXIT_CODES as l, type PlanCompletionMode as m, type PlanConstraint as n, type PlanExitCode as o, type PlanStatus as p, type PlanStep as q, type PrecedenceResolution as r, type RoleCheck as s, type SafetyCheck as t, type VerdictEvidence as u };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generateImpactReport,
|
|
3
3
|
renderImpactReport
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KTFTTLTP.js";
|
|
5
5
|
import {
|
|
6
6
|
readAuditLog
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-REXY4LUL.js";
|
|
8
|
+
import "./chunk-IZSO75NZ.js";
|
|
9
|
+
import "./chunk-QLPTHTVB.js";
|
|
10
10
|
import "./chunk-YZFATT7X.js";
|
|
11
11
|
|
|
12
12
|
// src/cli/impact.ts
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveWorldPath
|
|
3
|
+
} from "./chunk-BQZMOEML.js";
|
|
1
4
|
import {
|
|
2
5
|
improveWorld,
|
|
3
6
|
renderImproveText
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-FYS2CBUW.js";
|
|
7
|
+
} from "./chunk-BMOXICAB.js";
|
|
6
8
|
import "./chunk-7P3S7MAY.js";
|
|
9
|
+
import "./chunk-FYS2CBUW.js";
|
|
7
10
|
import {
|
|
8
11
|
loadWorld
|
|
9
12
|
} from "./chunk-JZPQGIKR.js";
|
|
@@ -26,28 +29,6 @@ function parseArgs(argv) {
|
|
|
26
29
|
}
|
|
27
30
|
return { worldPath, json };
|
|
28
31
|
}
|
|
29
|
-
async function resolveWorldPath(input) {
|
|
30
|
-
const { stat } = await import("fs/promises");
|
|
31
|
-
try {
|
|
32
|
-
const info = await stat(input);
|
|
33
|
-
if (info.isDirectory()) return input;
|
|
34
|
-
} catch {
|
|
35
|
-
}
|
|
36
|
-
const neuroversePath = `.neuroverse/worlds/${input}`;
|
|
37
|
-
try {
|
|
38
|
-
const info = await stat(neuroversePath);
|
|
39
|
-
if (info.isDirectory()) return neuroversePath;
|
|
40
|
-
} catch {
|
|
41
|
-
}
|
|
42
|
-
throw new Error(
|
|
43
|
-
`World not found: "${input}"
|
|
44
|
-
Tried:
|
|
45
|
-
${input}
|
|
46
|
-
${neuroversePath}
|
|
47
|
-
|
|
48
|
-
Build a world first: neuroverse build <input.md>`
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
32
|
async function main(argv = process.argv.slice(2)) {
|
|
52
33
|
try {
|
|
53
34
|
const args = parseArgs(argv);
|