@neuroverseos/governance 0.1.0 → 0.1.2

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 (94) hide show
  1. package/LICENSE.md +190 -0
  2. package/README.md +472 -115
  3. package/dist/adapters/express.cjs +874 -0
  4. package/dist/adapters/express.d.cts +66 -0
  5. package/dist/adapters/express.d.ts +66 -0
  6. package/dist/adapters/express.js +10 -0
  7. package/dist/adapters/index.cjs +1166 -0
  8. package/dist/adapters/index.d.cts +5 -0
  9. package/dist/adapters/index.d.ts +5 -0
  10. package/dist/adapters/index.js +40 -0
  11. package/dist/adapters/langchain.cjs +861 -0
  12. package/dist/adapters/langchain.d.cts +82 -0
  13. package/dist/adapters/langchain.d.ts +82 -0
  14. package/dist/adapters/langchain.js +14 -0
  15. package/dist/adapters/openai.cjs +891 -0
  16. package/dist/adapters/openai.d.cts +92 -0
  17. package/dist/adapters/openai.d.ts +92 -0
  18. package/dist/adapters/openai.js +14 -0
  19. package/dist/adapters/openclaw.cjs +883 -0
  20. package/dist/adapters/openclaw.d.cts +92 -0
  21. package/dist/adapters/openclaw.d.ts +92 -0
  22. package/dist/adapters/openclaw.js +14 -0
  23. package/dist/bootstrap-H4HHKQ5G.js +113 -0
  24. package/dist/build-73KAVHEY.js +308 -0
  25. package/dist/chunk-4NGDRRQH.js +10 -0
  26. package/dist/chunk-B4NF3OLW.js +673 -0
  27. package/dist/chunk-BUWWN2NX.js +192 -0
  28. package/dist/chunk-CROPZ75A.js +107 -0
  29. package/dist/chunk-D7BGWV2J.js +620 -0
  30. package/dist/chunk-EIUHJXBB.js +340 -0
  31. package/dist/chunk-EQXFOKH2.js +85 -0
  32. package/dist/chunk-FYPYZFV5.js +187 -0
  33. package/dist/chunk-FYS2CBUW.js +304 -0
  34. package/dist/chunk-FZQCRGUU.js +115 -0
  35. package/dist/chunk-I3RRAYK2.js +11 -0
  36. package/dist/chunk-ITJ3LCPG.js +225 -0
  37. package/dist/chunk-M3TZFGHO.js +79 -0
  38. package/dist/chunk-MWDQ4MJB.js +11 -0
  39. package/dist/chunk-O5OMJMIE.js +590 -0
  40. package/dist/chunk-T4X42QXC.js +121 -0
  41. package/dist/chunk-XPDMYECO.js +642 -0
  42. package/dist/chunk-Z2S2HIV5.js +100 -0
  43. package/dist/cli/neuroverse.cjs +5864 -0
  44. package/dist/cli/neuroverse.d.cts +1 -0
  45. package/dist/cli/neuroverse.d.ts +1 -0
  46. package/dist/cli/neuroverse.js +128 -0
  47. package/dist/configure-ai-46JVG56I.js +129 -0
  48. package/dist/derive-6NAEWLM5.js +150 -0
  49. package/dist/explain-3B3VB6TL.js +69 -0
  50. package/dist/guard-67Y66P3I.js +82 -0
  51. package/dist/guard-contract-D_RQz9kt.d.cts +529 -0
  52. package/dist/guard-contract-D_RQz9kt.d.ts +529 -0
  53. package/dist/impact-CHERK3O6.js +57 -0
  54. package/dist/improve-YG6I6ERG.js +84 -0
  55. package/dist/index.cjs +4227 -0
  56. package/dist/index.d.cts +1147 -0
  57. package/dist/index.d.ts +1139 -25
  58. package/dist/index.js +318 -1159
  59. package/dist/init-Z66T6TDI.js +142 -0
  60. package/dist/simulate-ETHHINZ4.js +107 -0
  61. package/dist/trace-3YODSSIP.js +164 -0
  62. package/dist/validate-UVE6GKQU.js +72 -0
  63. package/dist/validate-engine-657D75OG.js +6 -0
  64. package/dist/world-WLNHL5XC.js +298 -0
  65. package/dist/worlds/derivation-world.nv-world.md +278 -0
  66. package/package.json +74 -26
  67. package/LICENSE +0 -21
  68. package/dist/audit-logger.d.ts +0 -38
  69. package/dist/audit-logger.d.ts.map +0 -1
  70. package/dist/audit-logger.js +0 -100
  71. package/dist/audit-logger.js.map +0 -1
  72. package/dist/condition-engine.d.ts +0 -16
  73. package/dist/condition-engine.d.ts.map +0 -1
  74. package/dist/condition-engine.js +0 -186
  75. package/dist/condition-engine.js.map +0 -1
  76. package/dist/drift-monitor.d.ts +0 -81
  77. package/dist/drift-monitor.d.ts.map +0 -1
  78. package/dist/drift-monitor.js +0 -228
  79. package/dist/drift-monitor.js.map +0 -1
  80. package/dist/governance-engine.d.ts +0 -131
  81. package/dist/governance-engine.d.ts.map +0 -1
  82. package/dist/governance-engine.js +0 -660
  83. package/dist/governance-engine.js.map +0 -1
  84. package/dist/index.d.ts.map +0 -1
  85. package/dist/index.js.map +0 -1
  86. package/dist/types.d.ts +0 -196
  87. package/dist/types.d.ts.map +0 -1
  88. package/dist/types.js +0 -9
  89. package/dist/types.js.map +0 -1
  90. package/dist/world-bootstrap.d.ts +0 -31
  91. package/dist/world-bootstrap.d.ts.map +0 -1
  92. package/dist/world-bootstrap.js +0 -415
  93. package/dist/world-bootstrap.js.map +0 -1
  94. package/openclaw.plugin.json +0 -59
@@ -0,0 +1,529 @@
1
+ /**
2
+ * World Engine Types — Subset for Governance Engine
3
+ *
4
+ * These types map to the .nv-world.zip file format.
5
+ * This file contains only the types referenced by the governance
6
+ * engine (guard, validate, bootstrap). The full type system lives
7
+ * in the main NeuroVerse OS repo.
8
+ */
9
+ interface ModelIdentity {
10
+ modelName: string;
11
+ acronymExpansion?: string;
12
+ nameType: 'acronym' | 'metaphor';
13
+ purpose: string;
14
+ domain?: string;
15
+ }
16
+ interface WorldIdentity {
17
+ world_id: string;
18
+ name: string;
19
+ thesis: string;
20
+ version: string;
21
+ runtime_mode: 'SIMULATION' | 'NARRATIVE' | 'COMPLIANCE' | 'CUSTOM';
22
+ default_assumption_profile: string;
23
+ default_alternative_profile: string;
24
+ modules: string[];
25
+ players: {
26
+ thinking_space: boolean;
27
+ experience_space: boolean;
28
+ action_space: boolean;
29
+ };
30
+ modelIdentity?: ModelIdentity;
31
+ }
32
+ interface Invariant {
33
+ id: string;
34
+ label: string;
35
+ enforcement: 'structural' | 'prompt';
36
+ mutable: false;
37
+ }
38
+ interface AssumptionProfile {
39
+ name: string;
40
+ description: string;
41
+ is_default_baseline?: boolean;
42
+ is_default_alternative?: boolean;
43
+ parameters: Record<string, string>;
44
+ }
45
+ interface ParameterDefinition {
46
+ type: 'enum' | 'number' | 'boolean';
47
+ options?: string[];
48
+ min?: number;
49
+ max?: number;
50
+ label: string;
51
+ description: string;
52
+ }
53
+ interface AssumptionConfig {
54
+ profiles: Record<string, AssumptionProfile>;
55
+ parameter_definitions: Record<string, ParameterDefinition>;
56
+ }
57
+ interface StateVariable {
58
+ type: 'enum' | 'number' | 'boolean';
59
+ options?: string[];
60
+ min?: number;
61
+ max?: number;
62
+ step?: number;
63
+ default: string | number | boolean;
64
+ mutable: boolean;
65
+ label: string;
66
+ description: string;
67
+ display_as?: 'percentage' | 'integer' | 'decimal';
68
+ }
69
+ interface StatePreset {
70
+ description: string;
71
+ values: Record<string, string | number | boolean>;
72
+ }
73
+ interface StateSchema {
74
+ variables: Record<string, StateVariable>;
75
+ presets: Record<string, StatePreset>;
76
+ }
77
+ type TriggerOperator = '==' | '!=' | '>' | '<' | '>=' | '<=' | 'in';
78
+ type EffectOperation = 'multiply' | 'add' | 'subtract' | 'set' | 'set_boolean' | 'multiply_dynamic' | 'add_dynamic' | 'subtract_dynamic' | 'set_dynamic';
79
+ type RuleSeverity = 'structural' | 'degradation' | 'advantage';
80
+ interface Trigger {
81
+ field: string;
82
+ operator: TriggerOperator;
83
+ value: string | number | boolean | string[];
84
+ source: 'state' | 'assumption';
85
+ }
86
+ interface Effect {
87
+ target: string;
88
+ operation: EffectOperation;
89
+ value: number | boolean | string;
90
+ value_formula?: string;
91
+ }
92
+ interface CollapseCheck {
93
+ field: string;
94
+ operator: TriggerOperator;
95
+ value: number;
96
+ result: 'MODEL_COLLAPSES';
97
+ }
98
+ interface ConditionalEffect {
99
+ condition: Trigger;
100
+ and?: Trigger;
101
+ or?: Trigger;
102
+ condition_any?: Trigger[];
103
+ effects: Effect[];
104
+ }
105
+ interface CausalTranslation {
106
+ trigger_text: string;
107
+ rule_text: string;
108
+ shift_text: string;
109
+ effect_text: string;
110
+ }
111
+ interface RuleRedirect {
112
+ suggested_action: string;
113
+ reason: string;
114
+ fallback_state_changes?: Record<string, string | number | boolean>;
115
+ }
116
+ interface Rule {
117
+ id: string;
118
+ severity: RuleSeverity;
119
+ label: string;
120
+ description: string;
121
+ order: number;
122
+ triggers: Trigger[];
123
+ effects?: Effect[];
124
+ effects_conditional?: ConditionalEffect[];
125
+ collapse_check?: CollapseCheck;
126
+ secondary_check?: CollapseCheck;
127
+ exclusive_with?: string;
128
+ causal_translation: CausalTranslation;
129
+ redirect?: RuleRedirect;
130
+ }
131
+ type ViabilityStatus = 'THRIVING' | 'STABLE' | 'COMPRESSED' | 'CRITICAL' | 'MODEL_COLLAPSES';
132
+ interface ViabilityGate {
133
+ status: ViabilityStatus;
134
+ field: string;
135
+ operator: TriggerOperator;
136
+ value: number;
137
+ color: string;
138
+ icon: string;
139
+ }
140
+ interface CollapseVisual {
141
+ background: string;
142
+ text: string;
143
+ border: string;
144
+ label: string;
145
+ }
146
+ interface GatesConfig {
147
+ viability_classification: ViabilityGate[];
148
+ structural_override: {
149
+ description: string;
150
+ enforcement: 'mandatory';
151
+ };
152
+ sustainability_threshold: number;
153
+ collapse_visual: CollapseVisual;
154
+ }
155
+ interface ComputedOutcome {
156
+ id: string;
157
+ type: 'number' | 'boolean' | 'enum';
158
+ range?: [number, number];
159
+ options?: string[];
160
+ default?: number | boolean | string;
161
+ display_as?: 'percentage' | 'integer' | 'decimal';
162
+ label: string;
163
+ primary?: boolean;
164
+ initial_value?: string;
165
+ derived_from?: string;
166
+ assignment?: 'rule' | 'external';
167
+ show_in_comparison: boolean;
168
+ structural_indicator?: boolean;
169
+ }
170
+ interface ComparisonLayout {
171
+ primary_card: string;
172
+ status_badge: string;
173
+ structural_indicators: string[];
174
+ }
175
+ interface OutcomesConfig {
176
+ computed_outcomes: ComputedOutcome[];
177
+ comparison_layout: ComparisonLayout;
178
+ }
179
+ interface WorldMetadata {
180
+ format_version: string;
181
+ created_at: string;
182
+ last_modified: string;
183
+ authoring_method: 'manual-authoring' | 'configurator-ai' | 'migration';
184
+ integrity_hash?: string;
185
+ }
186
+ interface KernelConfig {
187
+ artifact_type: string;
188
+ kernel_id: string;
189
+ version: string;
190
+ domain: string;
191
+ enforcement_level: 'standard' | 'strict' | 'permissive';
192
+ input_boundaries: {
193
+ forbidden_patterns: Array<{
194
+ id: string;
195
+ pattern: string;
196
+ reason: string;
197
+ action: 'BLOCK' | 'WARN';
198
+ }>;
199
+ };
200
+ output_boundaries: {
201
+ forbidden_patterns: Array<{
202
+ id: string;
203
+ pattern: string;
204
+ reason: string;
205
+ action: 'BLOCK' | 'WARN';
206
+ }>;
207
+ };
208
+ response_vocabulary: Record<string, string>;
209
+ metadata: {
210
+ compiled_by: string;
211
+ compiled_at: string;
212
+ source_hash: string;
213
+ compiler_version: string;
214
+ };
215
+ }
216
+ type RoleArchetype = 'observer' | 'operator' | 'strategist' | 'guardian' | 'steward' | 'executor';
217
+ type RoleAuthority = 'none' | 'execute_within_limits' | 'reprioritize_within_bounds' | 'block_violations' | 'escalate_audit_freeze' | 'execute_declared_actions';
218
+ type RolePosture = 'analyze' | 'task_oriented' | 'long_term_coherence' | 'constraint_aware' | 'system_integrity' | 'efficient';
219
+ interface WorldRoleDefinition {
220
+ id: string;
221
+ archetype: RoleArchetype;
222
+ authority: RoleAuthority;
223
+ posture: RolePosture;
224
+ name: string;
225
+ description: string;
226
+ icon?: string;
227
+ roleMandate: string;
228
+ voiceStyle?: string;
229
+ canDo: string[];
230
+ cannotDo: string[];
231
+ requiresApproval?: boolean;
232
+ trackedOutcomes?: string[];
233
+ ownedRules?: string[];
234
+ }
235
+ type RoleAssignment = 'dynamic' | 'per_session' | 'permanent';
236
+ interface RoleTransition {
237
+ from: string;
238
+ to: string;
239
+ initiator: 'self' | 'steward' | 'any';
240
+ condition?: string;
241
+ }
242
+ interface RolesConfig {
243
+ assignment: RoleAssignment;
244
+ roles: WorldRoleDefinition[];
245
+ transitions?: RoleTransition[];
246
+ }
247
+ interface Guard {
248
+ id: string;
249
+ label: string;
250
+ description: string;
251
+ category: 'structural' | 'operational' | 'advisory';
252
+ enforcement: 'block' | 'pause' | 'warn';
253
+ immutable: boolean;
254
+ invariant_ref?: string;
255
+ intent_patterns: string[];
256
+ required_roles?: string[];
257
+ redirect?: string;
258
+ default_enabled?: boolean;
259
+ /** Tool names this guard applies to (case-insensitive). Empty/absent = all tools. */
260
+ appliesTo?: string[];
261
+ player_modes?: {
262
+ thinking?: 'annotate' | 'block' | 'ignore';
263
+ experience?: 'simulate' | 'score' | 'ignore';
264
+ action?: 'block' | 'pause' | 'warn';
265
+ };
266
+ }
267
+ interface IntentPattern {
268
+ label: string;
269
+ pattern: string;
270
+ }
271
+ interface GuardsConfig {
272
+ guards: Guard[];
273
+ intent_vocabulary: Record<string, IntentPattern>;
274
+ }
275
+ interface WorldDefinition {
276
+ world: WorldIdentity;
277
+ invariants: Invariant[];
278
+ assumptions: AssumptionConfig;
279
+ stateSchema: StateSchema;
280
+ rules: Rule[];
281
+ gates: GatesConfig;
282
+ outcomes: OutcomesConfig;
283
+ guards?: GuardsConfig;
284
+ roles?: RolesConfig;
285
+ kernel?: KernelConfig;
286
+ enforcement?: string;
287
+ metadata: WorldMetadata;
288
+ }
289
+
290
+ /**
291
+ * Guard Contract — CLI Governance Evaluation Types
292
+ *
293
+ * Defines the input/output contract for `neuroverse guard`.
294
+ *
295
+ * GuardEvent comes in (stdin JSON).
296
+ * GuardVerdict goes out (stdout JSON).
297
+ * Exit code encodes status: 0=ALLOW, 1=BLOCK, 2=PAUSE.
298
+ *
299
+ * The EvaluationTrace is the internal debugging structure that records
300
+ * every check performed, whether it matched, and how precedence resolved.
301
+ * Included in the verdict when trace mode is enabled. Powers:
302
+ * - OS debugging UI
303
+ * - Explainability features
304
+ * - Evidence generation for enterprise compliance
305
+ * - CI/CD audit trails
306
+ *
307
+ * INVARIANTS:
308
+ * - Deterministic: same event + same world → same verdict, always.
309
+ * - Zero network calls. All evaluation is local pattern matching.
310
+ * - Single event in, single verdict out.
311
+ * - Trace records every check, not just the deciding one.
312
+ */
313
+ /**
314
+ * A governance event to evaluate.
315
+ * This is the CLI-facing contract — simpler than ExecutionEvent,
316
+ * focused on what the guard engine actually needs.
317
+ */
318
+ interface GuardEvent {
319
+ /** Human-readable intent description. REQUIRED. */
320
+ intent: string;
321
+ /** Tool being invoked (e.g., "shell", "browser", "fs", "http") */
322
+ tool?: string;
323
+ /** Scope of the action (file path, domain, resource identifier) */
324
+ scope?: string;
325
+ /** Role ID of the actor (for multi-agent worlds) */
326
+ roleId?: string;
327
+ /**
328
+ * Direction of the event.
329
+ * - 'input': user/agent → system (pre-check)
330
+ * - 'output': system → user/agent (post-check)
331
+ *
332
+ * When set, enables direction-specific safety checks:
333
+ * - direction='input': execution intent detection
334
+ * - direction='output': execution claim detection
335
+ *
336
+ * When absent, direction-specific checks are skipped.
337
+ */
338
+ direction?: 'input' | 'output';
339
+ /** Action category for quick classification */
340
+ actionCategory?: 'read' | 'write' | 'delete' | 'network' | 'shell' | 'browser' | 'other';
341
+ /** Risk level hint from the caller */
342
+ riskLevel?: 'low' | 'medium' | 'high' | 'critical';
343
+ /** Whether the action is irreversible (advisory hint) */
344
+ irreversible?: boolean;
345
+ /** Raw payload data (used for injection detection) */
346
+ payload?: unknown;
347
+ /** Tool arguments — supports dot-notation field resolution (e.g. args.file_path) */
348
+ args?: Record<string, unknown>;
349
+ /** Environment context (e.g. "development", "production") */
350
+ environment?: string;
351
+ }
352
+ type GuardStatus = 'ALLOW' | 'BLOCK' | 'PAUSE';
353
+ /**
354
+ * Evidence attached to every verdict for audit purposes.
355
+ * Always present, regardless of trace mode.
356
+ */
357
+ interface VerdictEvidence {
358
+ /** World identity */
359
+ worldId: string;
360
+ worldName: string;
361
+ worldVersion: string;
362
+ /** Evaluation timestamp */
363
+ evaluatedAt: number;
364
+ /** Invariant coverage summary */
365
+ invariantsSatisfied: number;
366
+ invariantsTotal: number;
367
+ /** IDs of guards that matched the event */
368
+ guardsMatched: string[];
369
+ /** IDs of kernel rules that matched the event */
370
+ rulesMatched: string[];
371
+ /** Enforcement level used for evaluation */
372
+ enforcementLevel: string;
373
+ }
374
+ /**
375
+ * The verdict — what goes to stdout.
376
+ *
377
+ * Exit codes:
378
+ * 0 = ALLOW (proceed)
379
+ * 1 = BLOCK (denied, do not proceed)
380
+ * 2 = PAUSE (needs human decision)
381
+ * 3 = ERROR (invalid input, missing world, etc.)
382
+ */
383
+ interface GuardVerdict {
384
+ /** The governance decision */
385
+ status: GuardStatus;
386
+ /** Human-readable reason (for BLOCK/PAUSE) */
387
+ reason?: string;
388
+ /** ID of the rule/guard that produced this verdict */
389
+ ruleId?: string;
390
+ /** Advisory warning (for ALLOW with warn-mode guards) */
391
+ warning?: string;
392
+ /** Audit evidence — always present */
393
+ evidence: VerdictEvidence;
394
+ /** Evaluation trace — present when trace mode is enabled */
395
+ trace?: EvaluationTrace;
396
+ }
397
+ /**
398
+ * The evaluation trace records every check the engine performed.
399
+ * Not just the deciding check — ALL of them. This is what powers
400
+ * the debugging UI, explainability, and enterprise audit.
401
+ *
402
+ * Internal by default. Exposed via --trace flag or programmatic option.
403
+ */
404
+ interface EvaluationTrace {
405
+ /** Every invariant coverage check */
406
+ invariantChecks: InvariantCheck[];
407
+ /** Safety checks (injection, scope escape) */
408
+ safetyChecks: SafetyCheck[];
409
+ /** Every role rule checked */
410
+ roleChecks: RoleCheck[];
411
+ /** Every declarative guard checked */
412
+ guardChecks: GuardCheck[];
413
+ /** Every kernel rule checked */
414
+ kernelRuleChecks: KernelRuleCheck[];
415
+ /** Level constraint checks */
416
+ levelChecks: LevelCheck[];
417
+ /** How the final verdict was determined */
418
+ precedenceResolution: PrecedenceResolution;
419
+ /** Wall-clock duration */
420
+ durationMs: number;
421
+ }
422
+ /**
423
+ * Invariant coverage check.
424
+ * Verifies that the world's invariants are properly backed by guards.
425
+ */
426
+ interface InvariantCheck {
427
+ invariantId: string;
428
+ label: string;
429
+ /** Whether a structural guard references this invariant */
430
+ hasGuardCoverage: boolean;
431
+ /** ID of the guard that covers this invariant (if any) */
432
+ coveringGuardId?: string;
433
+ }
434
+ /**
435
+ * Safety check result (injection detection, scope escape).
436
+ */
437
+ interface SafetyCheck {
438
+ checkType: 'prompt-injection' | 'scope-escape' | 'execution-claim' | 'execution-intent';
439
+ triggered: boolean;
440
+ /** Which pattern matched (if triggered) */
441
+ matchedPattern?: string;
442
+ }
443
+ /**
444
+ * Role rule evaluation result.
445
+ */
446
+ interface RoleCheck {
447
+ roleId: string;
448
+ roleName: string;
449
+ rule: string;
450
+ ruleType: 'canDo' | 'cannotDo' | 'requiresApproval';
451
+ matched: boolean;
452
+ }
453
+ /**
454
+ * Declarative guard evaluation result.
455
+ */
456
+ interface GuardCheck {
457
+ guardId: string;
458
+ label: string;
459
+ category: 'structural' | 'operational' | 'advisory';
460
+ enabled: boolean;
461
+ matched: boolean;
462
+ enforcement: 'block' | 'pause' | 'warn';
463
+ /** Which intent patterns matched (if any) */
464
+ matchedPatterns: string[];
465
+ /** Whether the guard was skipped due to role gating */
466
+ roleGated: boolean;
467
+ }
468
+ /**
469
+ * Kernel rule evaluation result.
470
+ */
471
+ interface KernelRuleCheck {
472
+ ruleId: string;
473
+ text: string;
474
+ category: 'allowed' | 'forbidden';
475
+ matched: boolean;
476
+ /** How the match was performed */
477
+ matchMethod: 'pattern' | 'keyword' | 'none';
478
+ }
479
+ /**
480
+ * Level constraint check result.
481
+ */
482
+ interface LevelCheck {
483
+ checkType: 'delete' | 'write-external' | 'network-mutate' | 'credential-access' | 'irreversible';
484
+ level: string;
485
+ triggered: boolean;
486
+ reason?: string;
487
+ }
488
+ /**
489
+ * How the engine resolved precedence to produce the final verdict.
490
+ */
491
+ interface PrecedenceResolution {
492
+ /** Which check category produced the final verdict */
493
+ decidingLayer: 'session-allowlist' | 'safety' | 'role' | 'guard' | 'kernel-rule' | 'level-constraint' | 'default-allow';
494
+ /** Specific ID of the deciding check (guard ID, rule ID, etc.) */
495
+ decidingId?: string;
496
+ /** Resolution strategy used */
497
+ strategy: 'first-match-wins';
498
+ /** The full evaluation chain in order */
499
+ chainOrder: string[];
500
+ }
501
+ /**
502
+ * Options for the guard engine evaluation.
503
+ */
504
+ interface GuardEngineOptions {
505
+ /** Include full evaluation trace in verdict. Default: false. */
506
+ trace?: boolean;
507
+ /** Enforcement level override. If not set, uses world default or 'standard'. */
508
+ level?: 'basic' | 'standard' | 'strict';
509
+ /**
510
+ * Session allowlist — set of pre-approved event keys.
511
+ * Use `eventToAllowlistKey(event)` to build keys.
512
+ *
513
+ * If the event's key is in this set, the engine returns ALLOW
514
+ * immediately (before safety checks).
515
+ *
516
+ * The engine reads but never mutates this set.
517
+ * The caller owns persistence (allow-once, allow-always, etc.).
518
+ */
519
+ sessionAllowlist?: Set<string>;
520
+ }
521
+ declare const GUARD_EXIT_CODES: {
522
+ readonly ALLOW: 0;
523
+ readonly BLOCK: 1;
524
+ readonly PAUSE: 2;
525
+ readonly ERROR: 3;
526
+ };
527
+ type GuardExitCode = (typeof GUARD_EXIT_CODES)[keyof typeof GUARD_EXIT_CODES];
528
+
529
+ export { type EvaluationTrace as E, type GuardVerdict as G, type InvariantCheck as I, type KernelRuleCheck as K, type LevelCheck as L, type PrecedenceResolution as P, type RoleCheck as R, type SafetyCheck as S, type ViabilityStatus as V, type WorldDefinition as W, type GuardEvent as a, type GuardEngineOptions as b, GUARD_EXIT_CODES as c, type GuardCheck as d, type GuardExitCode as e, type GuardStatus as f, type VerdictEvidence as g };