Add engagement-only conversation mode
This commit is contained in:
1 parent
b7fcc7db05
commit
7af7b211fa
24 files changed
+204
-23
No files matched your search
@@ -27,14 +27,15 @@ export const ConversationTriageStatusSchema = z.enum(['open', 'snoozed', 'done']
|
||||
*/
|
||||
export const ConversationAutomationStatusSchema = z.enum([
|
||||
'active',
|
||||
'engaged',
|
||||
'image-received',
|
||||
'human-required',
|
||||
'boundary',
|
||||
'user-overridden',
|
||||
'killed',
|
||||
]);
|
||||
/** The policy snapshotted when the conversation started. `manual` never auto-replies. */
|
||||
export const ConversationPolicyModeSchema = z.enum(['legacy', 'r4r', 'r4r-media', 'manual']);
|
||||
/** The policy snapshotted when the conversation started. `engagement` and `manual` never auto-reply. */
|
||||
export const ConversationPolicyModeSchema = z.enum(['legacy', 'engagement', 'r4r', 'r4r-media', 'manual']);
|
||||
|
||||
export const ActiveChatSchema = z.strictObject({
|
||||
username: z.string(),
|
||||
|
||||
@@ -37,7 +37,13 @@ export const RuntimeConfigSchema = z.strictObject({
|
||||
reddit: RuntimeRedditConfigSchema,
|
||||
});
|
||||
export const ConversationBehaviourSchema = z.strictObject({
|
||||
mode: z.union([z.literal('legacy'), z.literal('r4r'), z.literal('r4r-media'), z.literal('manual')]).default('legacy'),
|
||||
mode: z.union([
|
||||
z.literal('legacy'),
|
||||
z.literal('engagement'),
|
||||
z.literal('r4r'),
|
||||
z.literal('r4r-media'),
|
||||
z.literal('manual'),
|
||||
]).default('legacy'),
|
||||
maxAutomatedTurns: z.number().int().min(1).max(MAX_CONFIGURED_AUTOMATED_CONVERSATION_TURNS).default(3),
|
||||
rapportTurnsBeforeMediaAsk: z.number().int().min(1).max(MAX_CONFIGURED_AUTOMATED_CONVERSATION_TURNS - 1).default(3),
|
||||
}).superRefine((behaviour, context) => {
|
||||
|
||||
@@ -12,7 +12,7 @@ export const LearningStatusSchema = z.enum(['provisional', 'eligible', 'excluded
|
||||
export const LearningTrajectorySchema = z.strictObject({
|
||||
id: z.string(), accountId: z.string(), conversationId: z.string(), sentMessageId: z.number().int().nullable(),
|
||||
subreddit: z.string().nullable(), sourceType: z.enum(['image', 'chat']).nullable(),
|
||||
policyMode: z.enum(['legacy', 'r4r', 'r4r-media', 'manual']).nullable(), firstHumanEventId: z.string().nullable(),
|
||||
policyMode: z.enum(['legacy', 'engagement', 'r4r', 'r4r-media', 'manual']).nullable(), firstHumanEventId: z.string().nullable(),
|
||||
outcomeEventId: z.string(), outcomeType: z.enum(['image-received', 'reciprocal-engagement']),
|
||||
creditClass: LearningCreditClassSchema, attributionConfidence: z.enum(['exact', 'fingerprint', 'inferred']),
|
||||
status: LearningStatusSchema, maturityAt: z.number(), invalidatedAt: z.number().nullable(),
|
||||
|
||||
@@ -177,6 +177,21 @@ describe('dashboard endpoint contracts', () => {
|
||||
expect(ConfigUpdateRequestSchema.safeParse({ browser: { dryRun: 'yes' } }).success).toBe(false);
|
||||
});
|
||||
|
||||
it('accepts engagement-only policy and terminal conversation state', () => {
|
||||
expect(ConfigUpdateRequestSchema.safeParse({
|
||||
subreddits: [{
|
||||
name: 'example', enabled: true, type: 'chat', targetingMode: 'post-author', tone: 'direct',
|
||||
conversation: { mode: 'engagement', maxAutomatedTurns: 3, rapportTurnsBeforeMediaAsk: 3 },
|
||||
}],
|
||||
}).success).toBe(true);
|
||||
expect(ChatsResponseSchema.safeParse([{
|
||||
...chat,
|
||||
automationPolicyMode: 'engagement',
|
||||
automationStatus: 'engaged',
|
||||
triageStatus: 'done',
|
||||
}]).success).toBe(true);
|
||||
});
|
||||
|
||||
it('validates chats, sync state, conversation detail, and malformed messages', () => {
|
||||
expect(ChatsResponseSchema.safeParse([chat]).success).toBe(true);
|
||||
expect(ConversationsResponseSchema.safeParse([chat]).success).toBe(true);
|
||||
|
||||
Reference in new issue
Block a user