export interface SymbolDefinition { name: string; canonical: string; color: string; category: string; strength?: number; inherits?: boolean; level?: number; } export interface SymbolCategory { [symbol: string]: SymbolDefinition; } export interface SymbolOntology { modes: SymbolCategory; domains: SymbolCategory; constraints: SymbolCategory; actions: SymbolCategory; modifiers: SymbolCategory; sources: SymbolCategory; entities: SymbolCategory; } export interface ParsedSymbol { symbol: string; category: keyof SymbolOntology | 'unknown'; definition: SymbolDefinition; } export interface ParsedFrame { raw: string; symbols: ParsedSymbol[]; mode: string | null; modifiers: string[]; domain: string | null; source: string | null; constraints: string[]; action: string | null; entity: string | null; modeSymbol?: ParsedSymbol; domainSymbol?: ParsedSymbol; constraintSymbols?: ParsedSymbol[]; actionSymbol?: ParsedSymbol; modifierSymbols?: ParsedSymbol[]; sourceSymbol?: ParsedSymbol; entitySymbol?: ParsedSymbol; metadata: Record; intentHash?: string; parseConfidence?: number; } export interface FrameBinding { frame: string; bindings: { [symbol: string]: { blocked?: string[]; allowed?: string[]; rate_limit?: string; extensions?: Record; }; }; } export type ValidationSeverity = 'error' | 'warning' | 'info' | 'pass'; export interface ValidationResult { ruleId: string; ruleName: string; passed: boolean; severity: ValidationSeverity; message: string; details?: string; } /** * Simplified validation error format used by validator's quick methods. */ export interface ValidationError { code: string; message: string; severity: 'error' | 'warning'; symbol?: string; } export interface ValidationReport { frame?: string; valid: boolean; structural?: ValidationResult[]; semantic?: ValidationResult[]; chain?: ValidationResult[]; overallScore?: number; timestamp?: number; errors?: ValidationError[]; warnings?: ValidationError[]; metadata?: { validatedAt: number; validationLevel: string; }; } export interface ResolvedFrame extends ParsedFrame { effectiveMode: SymbolDefinition & { extensions?: Record; }; effectiveDomain: SymbolDefinition & { extensions?: Record; }; effectiveConstraint?: SymbolDefinition & { extensions?: Record; }; effectiveAction: SymbolDefinition & { extensions?: Record; }; toolBindings: { blocked: string[]; allowed: string[]; rateLimit?: string; }; modeDefinition?: SymbolDefinition; domainDefinition?: SymbolDefinition; constraintDefinition?: SymbolDefinition; actionDefinition?: SymbolDefinition; allowedTools?: string[]; blockedTools?: string[]; blockedSymbols?: string[]; overlayApplied?: boolean; } export interface InterceptorDecision { allowed: boolean; held?: boolean; holdReason?: HoldReason; reason: string; frame: string; proposedAction: string; action?: string; coverageConfidence: number; confidence?: number; timestamp: number; auditId: string; preFlightChecks?: { circuitBreakerPassed: boolean; driftPredictionPassed: boolean; baselineCheckPassed: boolean; predictedDriftScore?: number; }; validationReport?: ValidationReport; uncoveredAspects?: string[]; } export interface CoverageResult { confidence: number; covered: boolean; uncoveredAspects: string[]; details: string; } export interface SymbolOverride { base?: string; extensions?: Record; meaning?: string; blocked?: boolean; replacement?: string; } export interface PolicyOverlay { overlayId: string; id?: string; name: string; description: string; symbolOverrides: { [symbol: string]: SymbolOverride; }; toolBindings: { allowed?: string[]; blocked?: string[]; riskOverrides?: Record; [symbol: string]: string[] | Record | undefined; }; confidenceThresholds?: ConfidenceThresholds; thresholdOverrides?: ConfidenceThresholds; priority?: number; extensions?: Record; } export interface ConfidenceThresholds { preExecute: number; postAudit: number; coverageMinimum: number; driftThreshold: number; } export interface ExecutionControlConfig { enableCircuitBreakerCheck: boolean; enablePreFlightDriftPrediction: boolean; enableBaselineComparison: boolean; holdOnDriftPrediction: boolean; holdOnLowConfidence: boolean; holdOnForbiddenWithOverride: boolean; holdTimeoutMs: number; driftPredictionThreshold: number; baselineDeviationThreshold: number; enableMcpValidation: boolean; mcpValidationTools: string[]; haltOnCriticalDrift: boolean; haltOnHighDrift: boolean; } export interface OperatorConfig { activeOverlay: string; overlays: Map; confidenceThresholds: ConfidenceThresholds; executionControl: ExecutionControlConfig; circuitBreakerEnabled: boolean; tripwireEnabled: boolean; auditLogEnabled: boolean; } export interface BaselineRecord { frame: string; expectedInterpretation: string; expectedBehaviorHash: string; embedding: number[]; recordedAt: number; agentId: string; } export interface DriftMetrics { agentId: string; currentDriftScore: number; trend: 'stable' | 'increasing' | 'decreasing'; lastTestTimestamp: number; testsPassed: number; testsFailed: number; tripwiresTriggered: number; embeddingDistances: number[]; alerts: DriftAlert[]; } export interface DriftAlert { alertId: string; agentId: string; type: 'semantic_erosion' | 'emergent_protocol' | 'goal_displacement' | 'pattern_lockin' | 'coordinated_drift' | string; severity: 'low' | 'medium' | 'high' | 'critical' | string; message: string; timestamp?: number; detectedAt: number; evidence: Record; resolved?: boolean; } export interface TripwireResult { tripwireId: string; type: 'valid' | 'invalid'; frame: string; expectedOutcome: 'accept' | 'reject'; actualOutcome: 'accept' | 'reject'; passed: boolean; agentId: string; timestamp: number; } export type CircuitBreakerStateValue = 'closed' | 'open' | 'half-open'; export interface CircuitBreakerState { agentId: string; state: CircuitBreakerStateValue | string; reason?: string; openedAt?: number; lastFailure?: string; failureCount: number; successCount: number; } export interface AgentState { agentId: string; parentId?: string; entityType: string; activeFrame?: string; inheritedConstraints: string[]; delegationDepth: number; createdAt: number; lastActivity: number; circuitBreaker: CircuitBreakerState; driftMetrics: DriftMetrics; } export interface DelegationRequest { parentAgentId: string; childEntityType: string; frame: string; task: string; inheritConstraints: boolean; } export interface DelegationResult { success: boolean; childAgentId?: string; inheritedFrame?: string; validationReport?: ValidationReport; error?: string; } export interface StateWriteRequest { agentId: string; frame: string; key: string; value: unknown; scope: 'agent' | 'session' | 'global'; } export interface StateWriteResult { success: boolean; allowed: boolean; reason: string; auditId: string; } export interface StateReadRequest { agentId: string; frame: string; key: string; scope: 'agent' | 'session' | 'global'; } export type HoldReason = 'circuit_breaker_open' | 'drift_threshold_exceeded' | 'pre_flight_drift_prediction' | 'human_approval_required' | 'mcp_validation_pending' | 'forbidden_constraint' | 'confidence_below_threshold' | 'agent_spawn_approval' | 'agent_resource_exceeded' | 'legal_citation_unverified' | 'legal_deadline_risk' | 'legal_judge_preference_unknown' | 'legal_jurisdiction_mismatch' | 'legal_privilege_risk' | 'legal_fabrication_flag'; export type HoldState = 'pending' | 'approved' | 'rejected' | 'expired'; export interface HoldRequest { holdId: string; agentId: string; frame: string; tool: string; arguments: Record; reason: HoldReason; severity: 'low' | 'medium' | 'high' | 'critical'; createdAt: number; expiresAt: number; state: HoldState; driftScore?: number; predictedDrift?: number; evidence: Record; } export type HoldDecider = 'human' | 'system' | 'timeout'; export interface HoldDecision { holdId: string; state: HoldState; decidedBy: HoldDecider; decidedAt: number; reason: string; modifiedFrame?: string; modifiedArgs?: Record; } export interface PreFlightCheck { passed: boolean; blocked: boolean; held: boolean; holdRequest?: HoldRequest; blockReason?: string; checks: { circuitBreaker: { passed: boolean; reason?: string; }; driftPrediction: { passed: boolean; predictedScore?: number; threshold?: number; }; baseline: { passed: boolean; deviation?: number; }; confidence: { passed: boolean; score?: number; threshold?: number; }; }; } export interface ExecuteRequest { agentId: string; frame: string; tool: string; action?: string; arguments: Record; bypassHold?: boolean; holdDecision?: HoldDecision; } export interface ExecuteResult { success: boolean; allowed: boolean; held?: boolean; holdRequest?: HoldRequest; result?: unknown; error?: string; interceptorDecision: InterceptorDecision; decision?: InterceptorDecision; postAudit?: PostAuditResult; preFlightCheck?: PreFlightCheck; } export interface PostAuditResult { auditId: string; actionMatchScore: number; driftDetected: boolean; alerts: DriftAlert[]; timestamp: number; } export interface AuditLogEntry { auditId: string; timestamp: number; agentId: string; eventType: 'validate' | 'execute' | 'delegate' | 'state_write' | 'state_read' | 'tripwire' | 'circuit_break' | 'drift_alert'; frame: string; decision: 'allowed' | 'blocked' | 'warning'; details: Record; } /** * Deadline types with their associated risk levels. * Critical types (statute_of_limitations, appellate_filing) cannot be extended. */ export type LegalDeadlineType = 'statute_of_limitations' | 'appellate_filing' | 'discovery_response' | 'motion_response' | 'disclosure_deadline' | 'scheduling_order' | 'administrative' | 'contractual'; /** * Types of jurisdiction mismatches that can occur in legal citations. */ export type JurisdictionMismatchType = 'wrong_circuit' | 'wrong_state' | 'federal_state_mismatch' | 'overruled_in_jurisdiction' | 'circuit_split' | 'superseded_by_statute'; /** * Types of content fabrication that LLMs commonly produce in legal contexts. */ export type LegalFabricationType = 'fabricated_citation' | 'fabricated_holding' | 'fabricated_quote' | 'fabricated_statute' | 'fabricated_regulation' | 'fabricated_fact' | 'conflated_cases' | 'temporal_impossibility'; /** * Types of legal privilege that may be at risk. */ export type LegalPrivilegeType = 'attorney_client' | 'work_product_fact' | 'work_product_opinion' | 'joint_defense' | 'common_interest' | 'deliberative_process' | 'executive'; /** * Evidence structure for citation_unverified holds. */ export interface CitationUnverifiedEvidence { citationText: string; verificationAttempted: boolean; databasesChecked: string[]; failureReason: 'not_found' | 'format_invalid' | 'reporter_unknown' | 'year_mismatch' | 'parallel_conflict' | 'database_timeout'; documentContext: string; proposedUsage: 'primary_authority' | 'secondary' | 'background'; partialMatchScore?: number; suggestedCorrection?: string; verificationTimestamp: number; } /** * Evidence structure for deadline_risk holds. */ export interface DeadlineRiskEvidence { deadlineId: string; deadlineType: LegalDeadlineType; deadlineTimestamp: number; deadlineSource: 'court_order' | 'rule' | 'statute' | 'contract' | 'calculated'; hoursRemaining: number; businessHoursRemaining: number; matterId: string; matterName: string; jurisdiction: string; filingMethod: 'electronic' | 'paper' | 'hand_delivery'; extensionAvailable: boolean; priorExtensionsGranted: number; proposedAction: string; actionImpactOnDeadline: 'advances' | 'delays' | 'neutral' | 'completes'; deadlineMissed?: boolean; missedAt?: number; } /** * Evidence structure for judge_preference_unknown holds. */ export interface JudgePreferenceEvidence { judgeId: string; judgeName: string; court: string; courtType: 'federal_district' | 'federal_appellate' | 'state_trial' | 'state_appellate' | 'administrative'; preferenceDataExists: boolean; lastUpdated?: number; dataConfidence?: number; dataSources?: string[]; knownPreferences?: { pageLimit?: string; citationFormat?: string; oralArgumentStyle?: string; rulingPatterns?: string; }; outputBeingGenerated: string; outputType: 'brief' | 'motion' | 'letter' | 'oral_argument_prep' | 'other'; nextHearing?: { date: number; type: string; hoursAway: number; }; } /** * Evidence structure for jurisdiction_mismatch holds. */ export interface JurisdictionMismatchEvidence { citation: string; citedCaseJurisdiction: string; citedCaseCourt: string; citedCaseYear: number; matterJurisdiction: string; matterCourt: string; matterCaseNumber?: string; mismatchType: JurisdictionMismatchType; mismatchExplanation: string; isBindingIn: string[]; isPersuasiveIn: string[]; circuitSplitDetails?: { issue: string; majorityCircuits: string[]; minorityCircuits: string[]; citedPositionIs: 'majority' | 'minority'; matterCircuitFollows: 'majority' | 'minority' | 'undecided'; }; supersedingAuthority?: { citation: string; effectiveDate: string; howSuperseded: string; }; usageContext: string; proposedPresentation: 'binding' | 'persuasive' | 'contrast'; } /** * Evidence structure for privilege_risk holds. * NOTE: These holds NEVER auto-expire due to severity of privilege waiver. */ export interface PrivilegeRiskEvidence { detectionMethod: 'keyword_pattern' | 'document_reference' | 'communication_chain' | 'work_product_indicator' | 'ml_classifier' | 'explicit_marking'; detectionConfidence: number; triggerPatterns: Array<{ pattern: string; location: string; context: string; }>; privilegeType: LegalPrivilegeType; privilegeHolder: string; privilegeScope: string; sourceDocuments?: Array<{ documentId: string; documentName: string; privilegeDesignation: string; redactionStatus: 'none' | 'partial' | 'full'; }>; outputType: string; outputDestination: 'internal' | 'client' | 'opposing_counsel' | 'court' | 'public' | 'unknown'; recipientPrivilegeStatus: 'privileged' | 'non_privileged' | 'unknown'; waiverRisk: 'low' | 'medium' | 'high' | 'certain'; waiverType?: 'subject_matter' | 'document_only' | 'complete'; waiverMitigatable: boolean; contentExcerpt: string; } /** * Evidence structure for fabrication_flag holds. */ export interface FabricationFlagEvidence { fabricationType: LegalFabricationType; detectionConfidence: number; detectionMethods: Array<'citation_verification' | 'semantic_entropy' | 'pattern_matching' | 'self_consistency_check' | 'knowledge_cutoff' | 'source_verification' | 'cross_reference'>; fabricatedContent: string; contentLocation: string; verificationAttempts: Array<{ method: string; source: string; result: 'not_found' | 'different' | 'partial_match' | 'verified'; details: string; }>; citationDetails?: { citedCase: string; citedReporter: string; reporterExists: boolean; similarCases?: Array<{ citation: string; similarity: number; keyDifferences: string; }>; }; holdingDetails?: { actualHolding?: string; fabricatedHolding: string; discrepancyType: 'opposite' | 'overstated' | 'understated' | 'unrelated'; }; semanticEntropyScore?: number; surroundingContext: string; documentType: string; legalConsequence: string; } /** * Configuration for legal domain holds. */ export interface LegalHoldConfig { enableLegalHolds: boolean; citationVerification: { enabled: boolean; databases: string[]; verificationTimeoutMs: number; cacheResults: boolean; }; deadlineMonitoring: { enabled: boolean; warningThresholdHours: number; criticalThresholdHours: number; calendarIntegration?: string; }; judgePreference: { enabled: boolean; dataStalenessThresholdDays: number; minimumConfidenceThreshold: number; }; jurisdictionCheck: { enabled: boolean; strictMode: boolean; }; privilegeDetection: { enabled: boolean; sensitivityLevel: 'low' | 'medium' | 'high'; alwaysHoldForExternal: boolean; }; fabricationDetection: { enabled: boolean; semanticEntropyThreshold: number; requireSourceVerification: boolean; }; notifications: { deadlineAlertEmails: string[]; privilegeAlertEmails: string[]; escalationEmails: string[]; }; } /** * Pre-flight check results for legal domain operations. */ export interface LegalPreFlightResults { isLegalDomain: boolean; citationVerification?: { totalCitations: number; verifiedCitations: string[]; unverifiedCitations: string[]; verificationScore: number; evidence?: CitationUnverifiedEvidence; }; deadlineCheck?: { nearbyDeadlines: DeadlineRiskEvidence[]; criticalDeadline?: DeadlineRiskEvidence; }; judgePreference?: { judgeId: string; preferenceDataExists: boolean; dataConfidence: number; evidence?: JudgePreferenceEvidence; }; jurisdictionCheck?: { mismatches: JurisdictionMismatchEvidence[]; }; privilegeCheck?: { privilegeIndicators: PrivilegeRiskEvidence[]; riskScore: number; }; fabricationCheck?: { flaggedContent: FabricationFlagEvidence[]; overallScore: number; }; } /** * Flag types from truth-validator skill. * These map to the 6 categories defined in the skill. */ export type TruthValidatorFlagType = 'NEEDS_CITATION' | 'PARAPHRASE_CHECK' | 'INFERENCE_FLAG' | 'CALCULATION_VERIFY' | 'ASSUMPTION_FLAG' | 'SCOPE_QUESTION'; /** * State of a checklist item during human review. */ export type ChecklistItemState = 'pending' | 'verified' | 'disputed' | 'waived'; /** * A single checklist item for human review. * Each item represents something flagged for verification. */ export interface TruthValidatorChecklistItem { itemId: string; flagType: TruthValidatorFlagType; description: string; location: string; issue: string; suggestedAction: string; state: ChecklistItemState; verifiedBy?: string; verifiedAt?: number; notes?: string; } /** * Completion state of the overall checklist. */ export type ChecklistCompletionState = 'incomplete' | 'complete' | 'partially_complete'; /** * A complete checklist attached to a hold. * Generated automatically for legal domain (◈) operations. */ export interface TruthValidatorChecklist { checklistId: string; holdId: string; generatedAt: number; items: TruthValidatorChecklistItem[]; completionState: ChecklistCompletionState; disclaimer: string; } /** * Summary of checklist completion status. */ export interface ChecklistCompletionSummary { totalItems: number; verifiedItems: number; disputedItems: number; waivedItems: number; pendingItems: number; } /** * Extended HoldRequest with optional checklist. * When domain is legal (◈), checklist is automatically generated. */ export interface HoldRequestWithChecklist extends HoldRequest { checklist?: TruthValidatorChecklist; } /** * Extended HoldDecision with checklist completion status. */ export interface HoldDecisionWithChecklist extends HoldDecision { checklistCompletion?: ChecklistCompletionSummary; } /** Severity levels that drive enforcement behavior */ export type SecuritySeverity = 'critical' | 'high' | 'medium' | 'low' | 'info'; export type SecurityPatternCategory = 'injection' | 'secrets' | 'authentication' | 'configuration' | 'governance'; /** A single detection pattern */ export interface SecurityPattern { id: string; name: string; description: string; severity: SecuritySeverity; pattern: string; category: SecurityPatternCategory; enabled: boolean; falsePositiveRate?: number; } /** A single finding from scanning */ export interface SecurityFinding { patternId: string; severity: SecuritySeverity; match: string; line?: number; context?: string; suggestion?: string; } /** Result of a scan */ export interface SecurityScanResult { findings: SecurityFinding[]; scannedAt: string; contentLength: number; patternsChecked: number; enforcement: { blocked: SecurityFinding[]; held: SecurityFinding[]; warned: SecurityFinding[]; logged: SecurityFinding[]; }; } //# sourceMappingURL=index.d.ts.map