/** * Inference Governance Integration Types * * Type definitions for the chrono-warp-drive Dynamo governance endpoint integration. * Provides external governance checking for inference-driven proposals. * * @since 2026-05-11 */ import type { InferenceProposal } from '../../inference/inference-cycle.js'; /** * Governance check request payload * Matches the Dynamo /governance endpoint format */ export interface GovernanceCheckRequest { proposalId: string; proposalText: string; codeDiff?: string; agentReviews: string[]; historicalSignalIds?: string[]; } /** * Governance check response from Dynamo endpoint */ export interface GovernanceCheckResponse { success: boolean; proposalId: string; governanceIsotopeId: string; resonanceScore: number; isotopicRatio: number; vortexVolume: number; historicalCoherence: number; recommendation: 'PASS' | 'NEEDS_REVISION' | 'REJECT'; confidence: number; voteWeight: number; reasons: string[]; } /** * Governance integration configuration */ export interface GovernanceIntegrationConfig { /** Whether the integration is enabled */ enabled: boolean; /** Governance endpoint URL */ endpointUrl: string; /** Request timeout in milliseconds */ requestTimeoutMs: number; /** Minimum confidence threshold for proposals */ minConfidenceThreshold: number; /** Decision logic configuration */ decisionLogic: { /** Minimum confidence for PASS recommendation */ passConfidenceMin: number; /** Maximum confidence for NEEDS_REVISION (below this is PASS, above is REJECT) */ revisionConfidenceMax: number; /** Multiplier for vote weight from governance */ voteWeightMultiplier: number; }; } /** * Public Dynamo Solar SSOT. Used only when a caller requires external * governance and neither features nor GOVERNANCE_ENDPOINT names a host. * The client posts to /call_connected_tool on this origin. */ export declare const PUBLIC_DYNAMO_SSOT = "https://mcp-production-80e2.up.railway.app"; /** * Origin for POST /call_connected_tool. * Preference: configured endpoint, then GOVERNANCE_ENDPOINT, then the public SSOT. */ export declare function resolveDynamoBaseUrl(configured: string): string; /** * Default governance configuration */ export declare const DEFAULT_GOVERNANCE_CONFIG: GovernanceIntegrationConfig; /** * Solar activity levels from NOAA GOES data */ export type SolarActivityLevel = 'quiet' | 'moderate' | 'active' | 'storm'; /** * Solar context returned by govern_with_solar */ export interface SolarContext { /** Current solar activity level */ solarActivityLevel: SolarActivityLevel; /** Solar isotopic resonance score (0-1) — canonical field */ solarIsotopicResonance: number; /** Alias for backward compatibility */ solarResonance?: number; /** Modifier applied to vote weight based on solar activity */ solarActivityModifier: number; /** Human-readable recommendation based on solar conditions */ recommendation: string; } /** * Solar-enhanced governance check request */ export interface SolarGovernanceCheckRequest { /** The proposal text to evaluate */ proposal: string; /** Starting vote weight (0.5 - 1.5) */ baseVoteWeight?: number; /** Whether to share the governance result publicly */ sharePublicly?: boolean; /** Spectral quality score for resonance analysis */ spectralQuality?: number; } /** * Solar-enhanced governance check response */ export interface SolarGovernanceCheckResponse { /** Original recommendation before solar adjustments */ originalRecommendation: string; /** Real-time solar context from NOAA GOES */ solarContext: SolarContext; /** Vote weight after solar adjustment */ adjustedVoteWeight: number; /** Final recommendation with solar warning appended if applicable */ finalRecommendation: string; /** Confidence adjustment applied due to solar activity */ confidenceAdjustment: number; /** Trinitarium Moral Overlay — moral alignment score (0-1) */ trinitariumMoralScore?: number | undefined; moralTension?: 'Aligned' | 'Mild' | 'Significant' | 'Critical' | undefined; trinitariumGematriaFusion?: number | undefined; detectedVirtues?: string[] | undefined; detectedConcerns?: string[] | undefined; /** Server-side authoritative recommendation */ recommendation?: string; /** Confidence score from governance */ confidence?: number; /** Resonance score */ resonanceScore?: number; /** Structural resonance metric */ structuralResonance?: number; /** Proximity metric */ proximity?: number; /** Phase alignment metric */ phaseAlignment?: number; /** Vortex alignment metric */ vortexAlignment?: number; /** Synchronization metric */ synchronization?: number; /** Signal timing indicator */ signalTiming?: string; /** Human-readable hammer reason */ hammerReason?: string; /** Whether neural context was used */ neuralContextUsed?: boolean; /** Spectral quality score */ spectralQuality?: number; } /** * Solar-enhanced vote result — extends standard vote with solar context */ export interface SolarGovernanceVoteResult extends GovernanceVoteResult { /** Solar context that influenced the decision */ solarContext: SolarContext; /** Confidence adjustment from solar activity */ solarConfidenceAdjustment: number; } /** * Governance vote result after applying decision logic */ export interface GovernanceVoteResult { /** Final vote decision */ vote: 'YES' | 'NO' | 'ABSTAIN'; /** Vote weight (affected by governance confidence) */ weight: number; /** Human-readable reason for the vote */ reason: string; /** Raw governance response for audit trail */ governanceResponse: GovernanceCheckResponse; /** Whether the proposal passed governance */ passed: boolean; /** Moral-Numerological Tension from Trinitarium Moral Overlay */ moralTension?: 'Aligned' | 'Mild' | 'Significant' | 'Critical' | undefined; moralScore?: number | undefined; moralFusion?: number | undefined; detectedVirtues?: string[] | undefined; detectedConcerns?: string[] | undefined; } /** * Batch governance check for multiple proposals */ export interface BatchGovernanceCheck { proposals: InferenceProposal[]; results: GovernanceVoteResult[]; batchId: string; timestamp: number; } /** * HTTP client configuration */ export interface GovernanceClientConfig { baseUrl: string; timeoutMs: number; retryAttempts?: number; retryDelayMs?: number; } /** * Client statistics */ export interface GovernanceClientStats { requestsTotal: number; requestsSucceeded: number; requestsFailed: number; averageResponseTimeMs: number; lastRequestAt?: number; errors: number; } /** * Governance error codes */ export declare enum GovernanceErrorCode { REQUEST_FAILED = "REQUEST_FAILED", TIMEOUT = "TIMEOUT", INVALID_RESPONSE = "INVALID_RESPONSE", NETWORK_ERROR = "NETWORK_ERROR", CONFIG_INVALID = "CONFIG_INVALID", NOT_INITIALIZED = "NOT_INITIALIZED" } /** * Base governance error */ export declare class GovernanceError extends Error { code: GovernanceErrorCode; recoverable: boolean; context?: Record | undefined; constructor(message: string, code: GovernanceErrorCode, recoverable: boolean, context?: Record | undefined); } /** * Request timeout error */ export declare class GovernanceTimeoutError extends GovernanceError { constructor(timeoutMs: number); } /** * Network error */ export declare class GovernanceNetworkError extends GovernanceError { constructor(url: string, originalError: Error); } /** * Type guard for valid governance response */ export declare function isValidGovernanceResponse(response: unknown): response is GovernanceCheckResponse; /** * Type guard for governance error */ export declare function isGovernanceError(error: unknown): error is GovernanceError;