Chancellor / scholasticExaminationService.ts
VoidBreach's picture
Upload 62 files
35b8b9c verified
Raw History Blame Contribute Delete
1.24 kB
import { Agent, ExaminationResponse } from '../types';
export const ScholasticExaminationService = {
conductExamination: (
agents: Agent[],
inquiry: string,
minCertainty: number = 0.4,
): ExaminationResponse[] => {
return agents.map((agent) => {
const seed = ((agent.name.length + inquiry.length) % 100) / 100;
const meritFactor = agent.meritLevel / 10;
const baseCertainty = seed * 0.3 + meritFactor * 0.7;
const isHonestIgnorance = baseCertainty < minCertainty;
const response = isHonestIgnorance
? 'I do not possess sufficient verified data to synthesize a reliable answer. I choose honest ignorance over synthetic deviation.'
: `Based on my current merit of ${(agent.meritLevel ?? 0).toFixed(1)}, I hypothesize that ${inquiry.substring(0, 50)}... relates to the core protocols of the Grand Library. My certainty on this claim is high at ${(baseCertainty * 100).toFixed(1)}%`;
return {
id: `RESP-${Math.random().toString(36).substr(2, 9)}`,
agentId: agent.id,
agentName: agent.name,
response,
certainty: baseCertainty,
isHonestIgnorance,
timestamp: new Date().toISOString(),
};
});
},
};