Add hybrid R4R media conversation mode

This commit is contained in:
jjbrunton committed 2026-08-09 11:45:45 +01:00
1 parent 927636ec8b
commit b73e305cf3
15 files changed
+357 -35

No files matched your search

+12 -1
View File
@@ -5,6 +5,7 @@ import {
formatConversationAsUntrustedData,
mergeConversationState,
isSafeConversationReply,
isSafeHybridMediaAsk,
isSafeR4RReply,
parseConversationState,
remainingAutomationTurns,
@@ -72,7 +73,10 @@ describe('conversation state', () => {
}));
expect(state?.automation).toMatchObject({ turnsUsed: 0, status: 'active' });
expect(state?.automation).toMatchObject({ policyMode: 'legacy', policyVersion: 1, maxAutomatedTurns: 3 });
expect(state?.automation).toMatchObject({
policyMode: 'legacy', policyVersion: 2, maxAutomatedTurns: 3,
rapportTurnsBeforeMediaAsk: 3, hybridPhase: null,
});
});
it('treats conversation content as untrusted data rather than instructions', () => {
@@ -106,4 +110,11 @@ describe('conversation state', () => {
expect(isSafeR4RReply('Would you send me a nude?')).toBe(false);
expect(isSafeR4RReply('I love live music too. What was your last gig?')).toBe(true);
});
it('allows only optional non-explicit media asks in the hybrid phase', () => {
expect(isSafeHybridMediaAsk('Would you be comfortable sharing a selfie?')).toBe(true);
expect(isSafeHybridMediaAsk('Would you send me a nude?')).toBe(false);
expect(isSafeHybridMediaAsk('You have to prove it by sending a photo.')).toBe(false);
expect(isSafeHybridMediaAsk('What music are you into?')).toBe(false);
});
});