Harden conversation replies and prioritize newest candidates

This commit is contained in:
jjbrunton committed 2026-08-09 18:16:57 +01:00
1 parent f98c5c732d
commit b8e4a1bb88
23 files changed
+598 -113

No files matched your search

+23 -1
View File
@@ -50,6 +50,28 @@ describe('conversation state', () => {
});
});
it.each([
'Zero interest in sending you anything lol',
"I'm good",
'Rather not, thanks',
])('treats a contextual media refusal as a boundary: %s', (refusal) => {
const state = buildConversationState([
message('Would you be comfortable sharing a selfie?', true),
message(refusal),
]);
expect(state.boundaries).toContain('does not want to send photos or videos');
});
it('does not treat a conversational wellbeing answer as a media refusal', () => {
const state = buildConversationState([
message('How are you?', true),
message("I'm good"),
]);
expect(state.boundaries).toEqual([]);
});
it('allows three progressive image-sharing turns before human handoff', () => {
const state = buildConversationState([message('Hello', true), message('Hey')]);
expect(remainingAutomationTurns(state)).toBe(3);
@@ -75,7 +97,7 @@ describe('conversation state', () => {
expect(state?.automation).toMatchObject({ turnsUsed: 0, status: 'active' });
expect(state?.sellerDetected).toBe(false);
expect(state?.automation).toMatchObject({
policyMode: 'legacy', policyVersion: 2, maxAutomatedTurns: 3,
policyMode: 'legacy', policyVersion: 3, maxAutomatedTurns: 3,
rapportTurnsBeforeMediaAsk: 3, hybridPhase: null,
});
});