Update roster fixtures and redact live provider keys (T90)

This commit is contained in:
2026-11-12 08:56:03 +00:00
parent d6e3158b80
commit 7d22f03b63
8 changed files with 29 additions and 34 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ export type Rule = { id: string; role: string; match: { kind?: string; text: str
export const textOf = (content: any): string => typeof content === 'string' ? content : (content ?? []).filter((part: any) => part.type === 'text').map((part: any) => part.text).join('\n');
export function answerFor(rules: Rule[], transcript: any) {
const system = JSON.stringify(transcript.messages.filter((message: any) => message.role === 'system'));
const role = /P3 role:([a-z]+)/.exec(system)?.[1];
const role = /P3 role:([a-zA-Z0-9_-]+)/.exec(system)?.[1];
const last = transcript.messages.findLast((message: any) => message.role !== 'system');
const rule = rules.find(rule => rule.role === role && (!rule.match.kind || rule.match.kind === last?.role) && textOf(last?.content).includes(rule.match.text));
if (!rule) throw new Error(`No scripted rule for ${role}: ${JSON.stringify(last)}`);