erosolar-cli
Version:
Unified AI agent framework for the command line - Multi-provider support with schema-driven tools, code intelligence, and transparent reasoning
98 lines • 2.92 kB
TypeScript
/**
* AI Response Verification System - Isolated Runtime Only
*
* Verifies assistant claims by spawning fresh CLI instances and running
* actual runtime tests. All verification happens in isolation.
*
* @license MIT
*/
export interface IsolatedRuntimeTest {
id: string;
description: string;
commands: string[];
shellCommands?: string[];
expectedOutputs?: string[];
expectedBehavior?: string;
timeout?: number;
requiresBuild?: boolean;
}
export interface IsolatedRuntimeResult {
test: IsolatedRuntimeTest;
success: boolean;
output: string;
errors: string;
exitCode: number | null;
duration: number;
matchedPatterns: string[];
unmatchedPatterns: string[];
llmAssessment?: string;
}
export interface VerificationContext {
workingDirectory: string;
conversationHistory?: string[];
provider: string;
model: string;
llmVerifier?: (prompt: string) => Promise<string>;
}
export interface Claim {
id: string;
statement: string;
category: string;
verifiable: boolean;
priority: 'critical' | 'high' | 'medium' | 'low';
context: Record<string, unknown>;
}
export interface ClaimVerificationResult {
claim: Claim;
verified: boolean;
confidence: 'high' | 'medium' | 'low';
evidence: string;
method: string;
reasoning?: string;
executedCode?: string;
rawOutput?: string;
error?: string;
timestamp: string;
}
export interface VerificationReport {
responseId: string;
timestamp: string;
claims: Claim[];
results: ClaimVerificationResult[];
summary: {
total: number;
verified: number;
failed: number;
inconclusive: number;
};
overallVerdict: 'verified' | 'partially_verified' | 'contradicted' | 'unverified';
trustScore: number;
}
/**
* Runs an isolated runtime test
*/
export declare function runIsolatedTest(test: IsolatedRuntimeTest, cwd: string, llmVerifier?: (prompt: string) => Promise<string>): Promise<IsolatedRuntimeResult>;
/**
* Verify an assistant response using a completely isolated process.
*
* This spawns a separate Node.js process to run all verification:
* - Separate memory space from main CLI
* - Separate event loop
* - Independent error handling
* - No shared state
*
* This ensures verification cannot interfere with the main process and vice versa.
*/
export declare function verifyResponse(response: string, ctx: VerificationContext, responseId?: string): Promise<VerificationReport>;
/**
* Format verification report for display
*/
export declare function formatVerificationReport(report: VerificationReport): string;
/**
* Quick verification - verify only critical/high priority claims
*/
export declare function quickVerify(response: string, ctx: VerificationContext): Promise<{
trustScore: number;
summary: string;
}>;
//# sourceMappingURL=responseVerifier.d.ts.map