/** * ISLSignal - Semantic contract between layers * * @remarks * ISLSignal is the external signal that ISL emits to be consumed by other layers. * * **Purpose:** * - Semantic contract between layers (AAL, SDK, Engine) * - Does not expose ISL internals * - Designed for external consumption without coupling * * **Difference with ISLResult:** * - ISLResult: Internal result of ISL pipeline (segments, lineage, complete metadata) * - ISLSignal: External semantic signal (risk scores, detections, security signals) * * **Architectural rule:** * A layer should never consume the internal "result" of another layer. * It consumes a signal. * * @example * ```typescript * // ISL processes and emits signal * const islResult = ISL.process(cslResult) // Internal * const islSignal = ISL.emitSignal(islResult) // External → AAL * * // AAL consumes the signal, not the result * const aalDecision = AAL.resolve(islSignal, policy) * ``` */ import type { RiskScore } from './value-objects/RiskScore.js'; import type { PiDetectionResult } from './value-objects/PiDetectionResult.js'; import type { RiskScoreStrategy } from './riskScore/types.js'; /** * Metadata for the signal (auditability, reproducibility). * Strategy is fixed at emit time; no per-segment or dynamic strategy. */ export interface ISLSignalMetadata { /** Risk score strategy used to compute riskScore. */ readonly strategy: RiskScoreStrategy; } /** * ISLSignal - Semantic signal emitted by ISL * * Represents the essential information that other layers need * to make decisions without knowing ISL's internal details. */ export interface ISLSignal { /** * Aggregated risk score of the processed content. * Range: 0.0 (no risk) to 1.0 (maximum risk) */ readonly riskScore: RiskScore; /** * Prompt injection detection result. * Contains all detected threats and their aggregated score. */ readonly piDetection: PiDetectionResult; /** * Indicates whether threats were detected in the content. * Semantic shortcut for quick verification. */ readonly hasThreats: boolean; /** * Timestamp of when the content was processed. * Useful for auditing and traceability. */ readonly timestamp: number; /** * Optional metadata (e.g. risk score strategy used). * Ensures auditability and reproducibility. */ readonly metadata?: ISLSignalMetadata; } /** * Creates an ISLSignal from an internal ISLResult * * @remarks * This function extracts the essential semantic information from the internal result * to create a signal that can be consumed by other layers without coupling. * * @param riskScore - Risk score value * @param piDetection - Prompt injection detection result * @param timestamp - Timestamp of the signal (default: Date.now()) * @param metadata - Optional metadata (e.g. risk score strategy) for auditability * @returns ISLSignal - Semantic signal for external consumption */ export declare function createISLSignal(riskScore: RiskScore, piDetection: PiDetectionResult, timestamp?: number, metadata?: ISLSignalMetadata): ISLSignal; /** * Checks if the signal indicates high risk * * @param signal - ISLSignal to evaluate * @param threshold - Risk threshold (default: 0.7) * @returns true if the risk score exceeds the threshold */ export declare function isHighRiskSignal(signal: ISLSignal, threshold?: number): boolean; /** * Checks if the signal indicates medium risk * * @param signal - ISLSignal to evaluate * @param lowThreshold - Lower threshold (default: 0.3) * @param highThreshold - Upper threshold (default: 0.7) * @returns true if the risk score is in the medium range */ export declare function isMediumRiskSignal(signal: ISLSignal, lowThreshold?: number, highThreshold?: number): boolean; /** * Checks if the signal indicates low risk * * @param signal - ISLSignal to evaluate * @param threshold - Risk threshold (default: 0.3) * @returns true if the risk score is below the threshold */ export declare function isLowRiskSignal(signal: ISLSignal, threshold?: number): boolean; //# sourceMappingURL=signals.d.ts.map