Fix conversation automation counter validation

This commit is contained in:
jjbrunton committed 2026-08-09 14:27:20 +01:00
1 parent b73e305cf3
commit c21932389e
3 files changed
+13 -4

No files matched your search

+3 -2
View File
@@ -1,5 +1,6 @@
import { z } from 'zod';
import { ErrorResponseSchema, RejectedActionResponseSchema } from './common.js';
import { MAX_CONFIGURED_AUTOMATED_CONVERSATION_TURNS } from './config.js';
import { RedditAccountOwnerSchema } from './session.js';
export const ChatMediaSchema = z.strictObject({
@@ -72,8 +73,8 @@ export const ConversationDetailResponseSchema = ActiveChatSchema.extend({
sentAt: z.number(),
}).nullable(),
automation: z.strictObject({
turnsUsed: z.number().int().min(0).max(3),
remainingTurns: z.number().int().min(0).max(3),
turnsUsed: z.number().int().min(0).max(MAX_CONFIGURED_AUTOMATED_CONVERSATION_TURNS),
remainingTurns: z.number().int().min(0).max(MAX_CONFIGURED_AUTOMATED_CONVERSATION_TURNS),
status: z.enum(['active', 'image-received', 'human-required', 'boundary', 'user-overridden']),
handoffReason: z.string().nullable(),
}),