@neuroverseos/governance 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/README.md +244 -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-XSANI3FK.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-UTVDGHB3.js} +5 -5
  39. package/dist/{chunk-JKGPSFGH.js → chunk-7FL3U7Z5.js} +3 -3
  40. package/dist/chunk-A2UZTLRV.js +421 -0
  41. package/dist/{chunk-TD5GKIHP.js → chunk-B3IIPTY3.js} +3 -3
  42. package/dist/chunk-EQR7BGFN.js +337 -0
  43. package/dist/{chunk-5JUZ4HL7.js → chunk-FDPPZLSQ.js} +3 -3
  44. package/dist/{chunk-MFKHTE5R.js → chunk-FKQCPRKI.js} +3 -3
  45. package/dist/{chunk-7D7PZLB7.js → chunk-FS2UUJJO.js} +3 -3
  46. package/dist/{chunk-U6FRAEQJ.js → chunk-GJ6LM4JZ.js} +1 -441
  47. package/dist/chunk-H3REGQRI.js +107 -0
  48. package/dist/{chunk-25XHSTPT.js → chunk-HDNDL6D5.js} +3 -3
  49. package/dist/{chunk-BXLTEUS4.js → chunk-I4RTIMLX.js} +2 -2
  50. package/dist/chunk-IOVXB6QN.js +447 -0
  51. package/dist/{chunk-Y6WXAPKY.js → chunk-NTHXZAW4.js} +3 -3
  52. package/dist/{chunk-UTH7OXTM.js → chunk-OTZU76DH.js} +22 -4
  53. package/dist/{chunk-DWHUZUEY.js → chunk-T6GMRZWC.js} +3 -3
  54. package/dist/{chunk-V4FZHJQX.js → chunk-TIXVEPS2.js} +3 -3
  55. package/dist/{chunk-YNYCQECH.js → chunk-TJ5L2UTE.js} +3 -3
  56. package/dist/chunk-UGTNKTHS.js +542 -0
  57. package/dist/cli/neuroverse.cjs +3372 -523
  58. package/dist/cli/neuroverse.js +53 -21
  59. package/dist/cli/plan.js +2 -2
  60. package/dist/cli/run.cjs +242 -139
  61. package/dist/cli/run.js +23 -3
  62. package/dist/cli/worldmodel.cjs +1624 -0
  63. package/dist/cli/worldmodel.d.cts +24 -0
  64. package/dist/cli/worldmodel.d.ts +24 -0
  65. package/dist/cli/worldmodel.js +742 -0
  66. package/dist/{demo-66MMJTEH.js → demo-6W3YXLAX.js} +4 -4
  67. package/dist/{derive-AUQE3L3P.js → derive-42IJW7JI.js} +4 -4
  68. package/dist/{doctor-EY7LKSYY.js → doctor-XEMLO6UA.js} +3 -2
  69. package/dist/engine/bootstrap-emitter.cjs +241 -0
  70. package/dist/engine/bootstrap-emitter.d.cts +27 -0
  71. package/dist/engine/bootstrap-emitter.d.ts +27 -0
  72. package/dist/{bootstrap-emitter-GIMOJFOC.js → engine/bootstrap-emitter.js} +2 -2
  73. package/dist/engine/bootstrap-parser.cjs +560 -0
  74. package/dist/engine/bootstrap-parser.d.cts +96 -0
  75. package/dist/engine/bootstrap-parser.d.ts +96 -0
  76. package/dist/{bootstrap-parser-LBLGVEMU.js → engine/bootstrap-parser.js} +2 -2
  77. package/dist/engine/guard-engine.cjs +1116 -0
  78. package/dist/engine/guard-engine.d.cts +60 -0
  79. package/dist/engine/guard-engine.d.ts +60 -0
  80. package/dist/{guard-engine-N7TUIUU7.js → engine/guard-engine.js} +3 -3
  81. package/dist/engine/simulate-engine.cjs +390 -0
  82. package/dist/engine/simulate-engine.d.cts +105 -0
  83. package/dist/engine/simulate-engine.d.ts +105 -0
  84. package/dist/engine/simulate-engine.js +9 -0
  85. package/dist/engine/worldmodel-compiler.cjs +366 -0
  86. package/dist/engine/worldmodel-compiler.d.cts +46 -0
  87. package/dist/engine/worldmodel-compiler.d.ts +46 -0
  88. package/dist/engine/worldmodel-compiler.js +17 -0
  89. package/dist/engine/worldmodel-parser.cjs +566 -0
  90. package/dist/engine/worldmodel-parser.d.cts +22 -0
  91. package/dist/engine/worldmodel-parser.d.ts +22 -0
  92. package/dist/engine/worldmodel-parser.js +7 -0
  93. package/dist/{equity-penalties-WWC7UDQD.js → equity-penalties-CCO3GVHS.js} +6 -6
  94. package/dist/{explain-MUSGDT67.js → explain-HDFN4ION.js} +1 -1
  95. package/dist/{guard-W3BMQPBJ.js → guard-IHJEKHL2.js} +16 -4
  96. package/dist/{guard-contract-CLBbTGK_.d.ts → guard-contract-ddiIPlOg.d.cts} +2 -369
  97. package/dist/{guard-contract-CLBbTGK_.d.cts → guard-contract-q6HJAq3Q.d.ts} +2 -369
  98. package/dist/{improve-PJDAWW4Q.js → improve-LRORRYEX.js} +3 -3
  99. package/dist/index.cjs +471 -1
  100. package/dist/index.d.cts +14 -492
  101. package/dist/index.d.ts +14 -492
  102. package/dist/index.js +63 -42
  103. package/dist/keygen-BSZH3NM2.js +77 -0
  104. package/dist/{lens-IP6GIZ2Q.js → lens-TLDZQXBI.js} +152 -26
  105. package/dist/{mcp-server-OG3PPVD2.js → mcp-server-CKYBHXWK.js} +2 -2
  106. package/dist/migrate-NH5PVMX4.js +221 -0
  107. package/dist/{playground-4BK2XQ47.js → playground-3TTBN7XD.js} +5 -5
  108. package/dist/{redteam-BRZALBPP.js → redteam-W644UMWN.js} +3 -3
  109. package/dist/{session-SGRUT2UH.js → session-FMAROEIE.js} +2 -2
  110. package/dist/{shared-CwGpPheR.d.ts → shared-DAzdfWtU.d.ts} +1 -1
  111. package/dist/{shared-BGzmYP5g.d.cts → shared-PpalGKxc.d.cts} +1 -1
  112. package/dist/sign-RRELHKWM.js +11 -0
  113. package/dist/{simulate-FGXKIH7V.js → simulate-VT437EEL.js} +2 -2
  114. package/dist/{test-PT44BSYG.js → test-XDB2DH3L.js} +3 -3
  115. package/dist/types.cjs +18 -0
  116. package/dist/types.d.cts +370 -0
  117. package/dist/types.d.ts +370 -0
  118. package/dist/types.js +0 -0
  119. package/dist/{validate-Q5O5TGLT.js → validate-M52DX22Y.js} +1 -1
  120. package/dist/verify-6AVTWX75.js +151 -0
  121. package/dist/{world-V52ZMH26.js → world-O4HTQPDP.js} +1 -1
  122. package/dist/{world-loader-C4D3VPP3.js → world-loader-YTYFOP7D.js} +1 -1
  123. package/dist/worldmodel-contract-BPGhiuW5.d.cts +221 -0
  124. package/dist/worldmodel-contract-BPGhiuW5.d.ts +221 -0
  125. package/dist/worlds/auki-vanguard.worldmodel.md +116 -0
  126. package/dist/worlds/behavioral-demo.nv-world.md +130 -0
  127. package/dist/worlds/neuroverse-governance.worldmodel.md +115 -0
  128. package/package.json +44 -3
  129. package/dist/{bootstrap-IP5QMC3Q.js → bootstrap-2OW5ZLBL.js} +3 -3
  130. package/dist/{chunk-4G6WHPLI.js → chunk-735Z3HA4.js} +6 -6
  131. package/dist/{chunk-7QIAF377.js → chunk-CYDMUJVZ.js} +0 -0
  132. package/dist/{configure-ai-LL3VAPQW.js → configure-ai-5MP5DWTT.js} +3 -3
  133. package/dist/{decision-flow-3K4D72G4.js → decision-flow-IJPNMVQK.js} +3 -3
package/dist/index.d.cts CHANGED
@@ -1,61 +1,14 @@
1
- import { G as GuardEvent, W as WorldDefinition, b as GuardEngineOptions, a as GuardVerdict, d as GuardStatus, e as GovernanceEvent, P as PlanDefinition, S as StepEvidence, A as AdvanceResult, f as PlanVerdict, g as PlanCheck, c as PlanProgress, h as AgentBehaviorState, C as Consequence, R as Reward, i as Guard, I as Invariant, j as Rule, V as ViabilityStatus } from './guard-contract-CLBbTGK_.cjs';
2
- export { E as EvaluationTrace, k as GUARD_EXIT_CODES, l as GuardCheck, m as GuardExitCode, n as IntentRecord, o as InvariantCheck, K as KernelRuleCheck, L as LevelCheck, p as PLAN_EXIT_CODES, q as PlanCompletionMode, r as PlanConstraint, s as PlanExitCode, t as PlanStatus, u as PlanStep, v as PrecedenceResolution, w as RoleCheck, x as SafetyCheck, y as VerdictEvidence } from './guard-contract-CLBbTGK_.cjs';
3
-
4
- /**
5
- * Guard Engine Deterministic Governance Evaluator
6
- *
7
- * Pure function: (event, world, options) → verdict
8
- *
9
- * Evaluates a GuardEvent against a loaded WorldDefinition and produces
10
- * a GuardVerdict with evidence and optional evaluation trace.
11
- *
12
- * Evaluation chain (first-match-wins on BLOCK/PAUSE):
13
- * 1. Safety checks (prompt injection, scope escape) → PAUSE
14
- * 1.5 Plan enforcement (task scope) → BLOCK/PAUSE
15
- * 2. Role-specific rules (cannotDo, requiresApproval) → BLOCK/PAUSE
16
- * 3. Declarative guards (guards.json) → BLOCK/PAUSE/WARN
17
- * 4. Kernel rules (kernel.json forbidden patterns) → BLOCK
18
- * 5. Level constraints (basic/standard/strict) → PAUSE
19
- * 6. Default → ALLOW
20
- *
21
- * Invariant checks run unconditionally and are recorded in evidence
22
- * but do not produce verdicts — they measure world health.
23
- *
24
- * INVARIANTS:
25
- * - Deterministic: same event + same world → same verdict.
26
- * - Zero network calls. Zero LLM calls. Zero async.
27
- * - Every check is recorded in the trace, not just the decider.
28
- * - No hidden logic. Everything is in the world file or declared here.
29
- */
30
-
31
- declare function evaluateGuard(event: GuardEvent, world: WorldDefinition, options?: GuardEngineOptions): GuardVerdict;
32
- /**
33
- * Build a normalized allowlist key from a GuardEvent.
34
- *
35
- * Format: `tool::intent` (both lowercased, intent trimmed).
36
- * Tool defaults to '*' when absent.
37
- *
38
- * Callers use this to:
39
- * 1. Add keys to the allowlist set (on user "allow-always" decision)
40
- * 2. The engine uses it to check membership before evaluation
41
- *
42
- * The key is opaque — callers should always use this function
43
- * rather than constructing keys manually.
44
- */
45
- declare function eventToAllowlistKey(event: GuardEvent): string;
46
- /**
47
- * Convert a guard verdict into a GovernanceEvent.
48
- *
49
- * The guard evaluation log IS the event stream.
50
- * No Kafka, no queues — just data flowing from Guard → Simulate.
51
- *
52
- * Mapping:
53
- * ALLOW → "action_allowed"
54
- * BLOCK → "action_blocked"
55
- * PAUSE → "action_paused"
56
- * + semantic type from intent when available
57
- */
58
- declare function verdictToEvent(status: GuardStatus, intent?: string): GovernanceEvent;
1
+ export { evaluateGuard, eventToAllowlistKey, verdictToEvent } from './engine/guard-engine.cjs';
2
+ import { b as GuardEngineOptions, G as GuardVerdict, a as GuardEvent, P as PlanDefinition, S as StepEvidence, A as AdvanceResult, e as PlanVerdict, f as PlanCheck, c as PlanProgress, g as AgentBehaviorState, d as GuardStatus, C as Consequence, R as Reward } from './guard-contract-ddiIPlOg.cjs';
3
+ export { E as EvaluationTrace, h as GUARD_EXIT_CODES, i as GuardCheck, j as GuardExitCode, I as IntentRecord, k as InvariantCheck, K as KernelRuleCheck, L as LevelCheck, l as PLAN_EXIT_CODES, m as PlanCompletionMode, n as PlanConstraint, o as PlanExitCode, p as PlanStatus, q as PlanStep, r as PrecedenceResolution, s as RoleCheck, t as SafetyCheck, V as VerdictEvidence } from './guard-contract-ddiIPlOg.cjs';
4
+ import { WorldDefinition, Guard, Invariant, Rule } from './types.cjs';
5
+ export { GovernanceEvent } from './types.cjs';
6
+ export { parseWorldMarkdown } from './engine/bootstrap-parser.cjs';
7
+ export { emitWorldDefinition } from './engine/bootstrap-emitter.cjs';
8
+ export { B as BOOTSTRAP_EXIT_CODES, b as BootstrapExitCode, c as BootstrapResult, a as ParseIssue, d as ParsedAssumptionProfile, e as ParsedEffect, f as ParsedFrontmatter, g as ParsedGate, h as ParsedInvariant, i as ParsedOutcome, j as ParsedRule, k as ParsedStateVariable, l as ParsedTrigger, P as ParsedWorld } from './bootstrap-contract-DcV6t-8M.cjs';
9
+ export { AppliedEffect, EventApplication, RuleEvaluation, SimulateOptions, SimulationResult, SimulationStep, renderSimulateText, simulateWorld } from './engine/simulate-engine.cjs';
10
+ export { ActionsOutput, GitHubAction, GitHubGovernanceBlockedError, GitHubGovernanceResult, GitHubGovernor, GitHubGovernorOptions, GitHubWebhookEvent, GitHubWebhookHandler, WebhookGovernanceResult, WebhookHandlerOptions, createGitHubGovernor, createGitHubGovernorFromWorld, createGitHubWebhookHandler, createGitHubWebhookHandlerFromWorld, formatForActions, formatPRComment } from './adapters/github.cjs';
11
+ import './shared-PpalGKxc.cjs';
59
12
 
60
13
  /**
61
14
  * Derive Contract — AI-Assisted World Synthesis Types
@@ -526,6 +479,8 @@ interface SessionState {
526
479
  agentStates: Map<string, AgentBehaviorState>;
527
480
  }
528
481
  declare class SessionManager {
482
+ /** Maximum unique agent IDs tracked before eviction. Prevents unbounded memory growth. */
483
+ private static readonly MAX_AGENTS;
529
484
  private config;
530
485
  private state;
531
486
  private engineOptions;
@@ -1427,337 +1382,6 @@ type ValidateExitCode = (typeof VALIDATE_EXIT_CODES)[keyof typeof VALIDATE_EXIT_
1427
1382
  */
1428
1383
  declare function validateWorld(world: WorldDefinition, mode?: ValidationMode): ValidateReport;
1429
1384
 
1430
- /**
1431
- * Bootstrap Contract — Markdown → WorldDefinition Compilation Types
1432
- *
1433
- * Defines the input/output contract for `neuroverse bootstrap`.
1434
- *
1435
- * Input: .nv-world.md file (structured markdown)
1436
- * Output: WorldDefinition (passed to validate, guard, or compileWorldToZip)
1437
- *
1438
- * The markdown format is:
1439
- * - YAML frontmatter for world identity and metadata
1440
- * - H1 sections for each block (Thesis, Invariants, State, etc.)
1441
- * - Structured sub-sections within each block
1442
- * - Deterministically parseable — no LLM, no heuristics
1443
- *
1444
- * Exit codes:
1445
- * 0 = SUCCESS (compiled cleanly)
1446
- * 1 = FAIL (parse errors, missing required sections)
1447
- * 3 = ERROR (file not found, invalid input)
1448
- */
1449
- type ParseSeverity = 'error' | 'warning' | 'info';
1450
- /**
1451
- * A single parse issue found during markdown compilation.
1452
- */
1453
- interface ParseIssue {
1454
- /** Line number in the source markdown (1-based) */
1455
- line: number;
1456
- /** Which section the issue was found in */
1457
- section: string;
1458
- /** Human-readable message */
1459
- message: string;
1460
- /** Severity */
1461
- severity: ParseSeverity;
1462
- }
1463
- /**
1464
- * The result of parsing a .nv-world.md file.
1465
- */
1466
- interface BootstrapResult {
1467
- /** Whether compilation succeeded (no errors) */
1468
- success: boolean;
1469
- /** Source file path */
1470
- sourcePath: string;
1471
- /** All parse issues */
1472
- issues: ParseIssue[];
1473
- /** Parsed sections (for debugging) */
1474
- parsedSections: string[];
1475
- /** Duration */
1476
- durationMs: number;
1477
- }
1478
- /**
1479
- * YAML frontmatter parsed from the markdown header.
1480
- */
1481
- interface ParsedFrontmatter {
1482
- world_id: string;
1483
- name: string;
1484
- version?: string;
1485
- runtime_mode?: string;
1486
- default_profile?: string;
1487
- alternative_profile?: string;
1488
- }
1489
- /**
1490
- * A parsed invariant from the Invariants section.
1491
- */
1492
- interface ParsedInvariant {
1493
- id: string;
1494
- label: string;
1495
- enforcement: string;
1496
- mutable: boolean;
1497
- line: number;
1498
- }
1499
- /**
1500
- * A parsed state variable from the State section.
1501
- */
1502
- interface ParsedStateVariable {
1503
- id: string;
1504
- type: 'number' | 'enum' | 'boolean';
1505
- default: string | number | boolean;
1506
- label: string;
1507
- description: string;
1508
- min?: number;
1509
- max?: number;
1510
- step?: number;
1511
- options?: string[];
1512
- line: number;
1513
- }
1514
- /**
1515
- * A parsed assumption profile from the Assumptions section.
1516
- */
1517
- interface ParsedAssumptionProfile {
1518
- id: string;
1519
- name: string;
1520
- description: string;
1521
- parameters: Record<string, string | number | boolean>;
1522
- line: number;
1523
- }
1524
- /**
1525
- * A parsed trigger from a rule.
1526
- */
1527
- interface ParsedTrigger {
1528
- field: string;
1529
- operator: string;
1530
- value: string | number | boolean;
1531
- source: 'state' | 'assumption';
1532
- }
1533
- /**
1534
- * A parsed effect from a rule.
1535
- */
1536
- interface ParsedEffect {
1537
- target: string;
1538
- operation: string;
1539
- value: number | boolean | string;
1540
- }
1541
- /**
1542
- * A parsed rule from the Rules section.
1543
- */
1544
- interface ParsedRule {
1545
- id: string;
1546
- label: string;
1547
- severity: string;
1548
- description?: string;
1549
- order: number;
1550
- triggers: ParsedTrigger[];
1551
- effects: ParsedEffect[];
1552
- collapse_check?: {
1553
- field: string;
1554
- operator: string;
1555
- value: number;
1556
- };
1557
- causal_translation?: {
1558
- trigger_text: string;
1559
- rule_text: string;
1560
- shift_text: string;
1561
- effect_text: string;
1562
- };
1563
- line: number;
1564
- }
1565
- /**
1566
- * A parsed gate from the Gates section.
1567
- */
1568
- interface ParsedGate {
1569
- status: string;
1570
- field: string;
1571
- operator: string;
1572
- value: number;
1573
- line: number;
1574
- }
1575
- /**
1576
- * A parsed outcome from the Outcomes section.
1577
- */
1578
- interface ParsedOutcome {
1579
- id: string;
1580
- type: string;
1581
- range?: [number, number];
1582
- display?: string;
1583
- label: string;
1584
- primary?: boolean;
1585
- assignment?: string;
1586
- line: number;
1587
- }
1588
- /**
1589
- * A parsed lens directive from the Lenses section.
1590
- */
1591
- interface ParsedLensDirective {
1592
- id: string;
1593
- scope: string;
1594
- instruction: string;
1595
- line: number;
1596
- }
1597
- /**
1598
- * A parsed lens from the Lenses section.
1599
- * Each lens is an H2 subsection with key-value properties and directives.
1600
- */
1601
- interface ParsedLens {
1602
- id: string;
1603
- name: string;
1604
- tagline: string;
1605
- description: string;
1606
- tags: string[];
1607
- /** Tone: formality, verbosity, emotion, confidence */
1608
- formality: string;
1609
- verbosity: string;
1610
- emotion: string;
1611
- confidence: string;
1612
- /** Which roles this lens is the default for */
1613
- defaultForRoles: string[];
1614
- /** Behavioral directives */
1615
- directives: ParsedLensDirective[];
1616
- /** Priority when stacking (higher = applied later) */
1617
- priority: number;
1618
- /** Whether it can be stacked with other lenses */
1619
- stackable: boolean;
1620
- line: number;
1621
- }
1622
- /**
1623
- * The full parsed intermediate representation.
1624
- */
1625
- interface ParsedWorld {
1626
- frontmatter: ParsedFrontmatter;
1627
- thesis: string;
1628
- invariants: ParsedInvariant[];
1629
- stateVariables: ParsedStateVariable[];
1630
- assumptions: ParsedAssumptionProfile[];
1631
- rules: ParsedRule[];
1632
- gates: ParsedGate[];
1633
- outcomes: ParsedOutcome[];
1634
- lenses: ParsedLens[];
1635
- lensPolicy?: 'locked' | 'role_default' | 'user_choice';
1636
- lensLockPin?: string;
1637
- }
1638
- declare const BOOTSTRAP_EXIT_CODES: {
1639
- readonly SUCCESS: 0;
1640
- readonly FAIL: 1;
1641
- readonly ERROR: 3;
1642
- };
1643
- type BootstrapExitCode = (typeof BOOTSTRAP_EXIT_CODES)[keyof typeof BOOTSTRAP_EXIT_CODES];
1644
-
1645
- /**
1646
- * Bootstrap Parser — .nv-world.md → ParsedWorld
1647
- *
1648
- * Deterministic markdown parser for the NeuroVerse world authoring format.
1649
- * No LLM calls. No heuristics. Pattern matching on structured markdown.
1650
- *
1651
- * ## Markdown Format (.nv-world.md)
1652
- *
1653
- * ```markdown
1654
- * ---
1655
- * world_id: my-world
1656
- * name: My World
1657
- * version: 1.0.0
1658
- * default_profile: baseline
1659
- * alternative_profile: alternative
1660
- * ---
1661
- *
1662
- * # Thesis
1663
- * The structural claim this world tests...
1664
- *
1665
- * # Invariants
1666
- * - `invariant_id` — Label text (structural, immutable)
1667
- * - `another_id` — Another label (structural, immutable)
1668
- *
1669
- * # State
1670
- * ## variable_name
1671
- * - type: number
1672
- * - min: 0
1673
- * - max: 100
1674
- * - step: 5
1675
- * - default: 50
1676
- * - label: Human Label
1677
- * - description: What this variable represents
1678
- *
1679
- * ## another_variable
1680
- * - type: enum
1681
- * - options: option_a, option_b, option_c
1682
- * - default: option_a
1683
- * - label: Another Variable
1684
- * - description: Description here
1685
- *
1686
- * # Assumptions
1687
- * ## baseline
1688
- * - name: Baseline Scenario
1689
- * - description: The default conditions
1690
- * - param_key: param_value
1691
- *
1692
- * ## alternative
1693
- * - name: Alternative Scenario
1694
- * - description: What changes
1695
- * - param_key: different_value
1696
- *
1697
- * # Rules
1698
- * ## rule-001: Rule Label (structural)
1699
- * Description of what this rule does.
1700
- *
1701
- * When field == "value" [state] AND other_field > 50 [assumption]
1702
- * Then target *= 0.30, other_target = false
1703
- * Collapse: field < 0.03
1704
- *
1705
- * > trigger: Trigger text here
1706
- * > rule: Rule text here
1707
- * > shift: Shift text here
1708
- * > effect: Effect text here
1709
- *
1710
- * # Gates
1711
- * - THRIVING: effective_margin >= 40
1712
- * - STABLE: effective_margin >= 20
1713
- * - COMPRESSED: effective_margin >= 10
1714
- * - CRITICAL: effective_margin > 3
1715
- * - MODEL_COLLAPSES: effective_margin <= 3
1716
- *
1717
- * # Outcomes
1718
- * ## outcome_id
1719
- * - type: number
1720
- * - range: 0-100
1721
- * - display: percentage
1722
- * - label: Outcome Label
1723
- * - primary: true
1724
- * ```
1725
- */
1726
-
1727
- /**
1728
- * Parse a .nv-world.md string into a ParsedWorld.
1729
- *
1730
- * Returns the parsed world and a list of issues.
1731
- * Callers should check issues for severity === 'error' before proceeding.
1732
- */
1733
- declare function parseWorldMarkdown(markdown: string): {
1734
- world: ParsedWorld | null;
1735
- issues: ParseIssue[];
1736
- };
1737
-
1738
- /**
1739
- * Bootstrap Emitter — ParsedWorld → WorldDefinition
1740
- *
1741
- * Converts the intermediate representation from the parser
1742
- * into a proper WorldDefinition that the guard engine, validate engine,
1743
- * and compileWorldToZip() all consume.
1744
- *
1745
- * Fills in sensible defaults for optional fields.
1746
- * Reports issues when the parsed data can't cleanly map to the target type.
1747
- *
1748
- * Deterministic. Same parsed input → same WorldDefinition output.
1749
- */
1750
-
1751
- /**
1752
- * Convert a ParsedWorld into a WorldDefinition.
1753
- *
1754
- * Returns the world definition and any issues encountered during emission.
1755
- */
1756
- declare function emitWorldDefinition(parsed: ParsedWorld): {
1757
- world: WorldDefinition;
1758
- issues: ParseIssue[];
1759
- };
1760
-
1761
1385
  /**
1762
1386
  * Add Engine — Incremental Governance Authoring
1763
1387
  *
@@ -2007,108 +1631,6 @@ interface WorldStats {
2007
1631
  declare function explainWorld(world: WorldDefinition): ExplainOutput;
2008
1632
  declare function renderExplainText(output: ExplainOutput): string;
2009
1633
 
2010
- /**
2011
- * Simulate Engine — Deterministic State Evolution (Reference Simulator)
2012
- *
2013
- * Pure function: (world, options) → SimulationResult
2014
- *
2015
- * This is NeuroVerse's REFERENCE SIMULATOR — one way to model how a world
2016
- * evolves over time. It is NOT the governance engine.
2017
- *
2018
- * simulateWorld() ≠ evaluateGuard()
2019
- *
2020
- * evaluateGuard() — Runtime enforcement. Decides if an action is allowed.
2021
- * Includes safety layer, role checks, plan enforcement,
2022
- * kernel rules, level constraints. Use for governance.
2023
- *
2024
- * simulateWorld() — State evolution modeling. Evaluates rule triggers,
2025
- * applies effects, tracks viability over N steps.
2026
- * Use for scenario planning and what-if analysis.
2027
- *
2028
- * World files (.nv-world.md) are portable — they define rules, roles, and
2029
- * constraints that can be consumed by any simulator or governance engine.
2030
- * This simulator is a reference implementation, not the only interpreter.
2031
- *
2032
- * Supports:
2033
- * - Single-step evaluation (default)
2034
- * - Multi-step iteration (--steps N)
2035
- * - State overrides (start from non-default values)
2036
- * - Assumption profile selection
2037
- * - Collapse detection (early termination)
2038
- *
2039
- * INVARIANTS:
2040
- * - Deterministic: same world + same options → same result.
2041
- * - Zero network calls. Zero LLM calls. Zero async.
2042
- * - Every rule evaluation is recorded in the trace.
2043
- * - World definition is REQUIRED — no world, no simulation.
2044
- */
2045
-
2046
- interface SimulateOptions {
2047
- /** Number of simulation steps (default: 1) */
2048
- steps?: number;
2049
- /** State variable overrides (start values) */
2050
- stateOverrides?: Record<string, string | number | boolean>;
2051
- /** Assumption profile to use (default: world default) */
2052
- profile?: string;
2053
- /**
2054
- * Governance events to inject into the simulation.
2055
- * Events are applied before state-driven rules each step.
2056
- * This is the bridge: Guard → Events → Simulate → State Evolution.
2057
- *
2058
- * Events are distributed across steps (round-robin) or all applied to step 1
2059
- * if there are fewer steps than events.
2060
- */
2061
- events?: GovernanceEvent[];
2062
- }
2063
- interface SimulationResult {
2064
- worldId: string;
2065
- worldName: string;
2066
- profile: string;
2067
- initialState: Record<string, string | number | boolean>;
2068
- steps: SimulationStep[];
2069
- finalState: Record<string, string | number | boolean>;
2070
- finalViability: ViabilityStatus;
2071
- collapsed: boolean;
2072
- collapseStep?: number;
2073
- collapseRule?: string;
2074
- /** Total events consumed during simulation */
2075
- eventsConsumed: number;
2076
- }
2077
- interface SimulationStep {
2078
- step: number;
2079
- /** Events applied during this step (before rules) */
2080
- eventsApplied: EventApplication[];
2081
- rulesEvaluated: RuleEvaluation[];
2082
- rulesFired: number;
2083
- stateAfter: Record<string, string | number | boolean>;
2084
- viability: ViabilityStatus;
2085
- collapsed: boolean;
2086
- }
2087
- /** Record of an event applied during simulation */
2088
- interface EventApplication {
2089
- eventType: string;
2090
- rulesTriggered: string[];
2091
- effects: AppliedEffect[];
2092
- }
2093
- interface RuleEvaluation {
2094
- ruleId: string;
2095
- label: string;
2096
- triggered: boolean;
2097
- excluded: boolean;
2098
- effects: AppliedEffect[];
2099
- collapsed: boolean;
2100
- collapseField?: string;
2101
- }
2102
- interface AppliedEffect {
2103
- target: string;
2104
- operation: string;
2105
- value: number | boolean | string;
2106
- before: string | number | boolean;
2107
- after: string | number | boolean;
2108
- }
2109
- declare function simulateWorld(world: WorldDefinition, options?: SimulateOptions): SimulationResult;
2110
- declare function renderSimulateText(result: SimulationResult): string;
2111
-
2112
1634
  /**
2113
1635
  * Improve Engine — Actionable Suggestions from World Analysis
2114
1636
  *
@@ -2416,4 +1938,4 @@ declare function handleCreateCapsule(body: {
2416
1938
  createdAt: string;
2417
1939
  };
2418
1940
 
2419
- export { type AIGuardOptions, type AIGuardVerdict, 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 ClassifiedIntent, type CollectedSource, CompositeAuditLogger, type Condition, type ConditionOperator, type ConditionResult, Consequence, ConsoleAuditLogger, type ConstructType, type ContentFields, DERIVE_EXIT_CODES, type DecisionFlow, type DecisionFlowMetrics, type DeriveExitCode, type DeriveFinding, type DeriveResult, type EventApplication, type ExplainOutput, FileAuditLogger, type FindingCategory, type FindingSeverity, type FlowPath, type FormatVerdictOptions, type GovernanceEngineOptions, GovernanceEvent, type GovernanceHealth, type Governor, type GovernorConfig, GuardEngineOptions, GuardEvent, GuardStatus, GuardVerdict, type ImpactReport, type ImprovementReport, type IntentClassifierOptions, type IntentCluster, type IntentSource, 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, classifyIntentWithAI, createAgentState, createGovernanceEngine, createGovernor, deriveWorld, describeActiveWorld, detectBehavioralPatterns, emitWorldDefinition, evaluateCondition, evaluateGuard, evaluateGuardWithAI, evaluatePlan, eventToAllowlistKey, explainWorld, extractContentFields, 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, verdictToEvent, writeTempWorld };
1941
+ export { type AIGuardOptions, type AIGuardVerdict, type AIProvider, type AIProviderConfig, type ActionCategory, type Adaptation, type AddGuardInput, type AddInvariantInput, type AddResult, type AddRuleInput, AdvanceResult, type AgentAction, AgentBehaviorState, type AuditEvent, type AuditLogger, type AuditSummary, type BehavioralPattern, CONFIGURE_AI_EXIT_CODES, type ChatMessage, type ClassifiedIntent, type CollectedSource, CompositeAuditLogger, type Condition, type ConditionOperator, type ConditionResult, Consequence, ConsoleAuditLogger, type ConstructType, type ContentFields, 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 IntentClassifierOptions, type IntentCluster, type IntentSource, McpGovernanceServer, type McpServerConfig, ModelAdapter, type ModelConfig, type ModelResponse, type NetworkContext, type NormalizationSummary, type OutcomeCluster, PROVIDERS, PlanCheck, PlanDefinition, type PlanParseResult, PlanProgress, PlanVerdict, type PreventionCategory, type ProviderPreset, Reward, type RuleObstacle, type SessionConfig, SessionManager, type SessionState, 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, classifyIntentWithAI, createAgentState, createGovernanceEngine, createGovernor, deriveWorld, describeActiveWorld, detectBehavioralPatterns, evaluateCondition, evaluateGuardWithAI, evaluatePlan, explainWorld, extractContentFields, extractWorldMarkdown, formatVerdict, formatVerdictOneLine, generateAdaptationNarrative, generateDecisionFlow, generateImpactReport, generateImpactReportFromFile, getActiveWorldName, getPlanProgress, govern, handleCreateCapsule, handleHealthCheck, handleListPresets, handleReasonRequest, improveWorld, listWorlds, loadWorld, loadWorldFromDirectory, normalizeWorldMarkdown, parseGuardDescription, parsePlanMarkdown, readAuditLog, renderDecisionFlow, renderExplainText, renderImpactReport, renderImproveText, resolveProvider, resolveWorldPath, runInteractiveMode, runPipeMode, setActiveWorld, summarizeAuditEvents, tickAgentStates, validateWorld, verdictToAuditEvent, writeTempWorld };