feat: automate bounded image-sharing conversations

This commit is contained in:
jjbrunton committed 2026-08-08 23:10:52 +01:00
1 parent dcf57273e2
commit 3beb8aada2
15 files changed
+477 -19

No files matched your search

+6
View File
@@ -69,6 +69,12 @@ export const ConversationDetailResponseSchema = ActiveChatSchema.extend({
imageUrl: z.string().nullable().optional(),
sentAt: z.number(),
}).nullable(),
automation: z.strictObject({
turnsUsed: z.number().int().min(0).max(3),
remainingTurns: z.number().int().min(0).max(3),
status: z.enum(['active', 'image-received', 'human-required', 'boundary', 'user-overridden']),
handoffReason: z.string().nullable(),
}),
syncInProgress: z.strictObject({
kind: SyncKindSchema.nullable(),
progress: SyncProgressSchema.nullable(),
@@ -142,7 +142,7 @@ describe('dashboard endpoint contracts', () => {
rateLimit: { minDelayBetweenMessagesMs: 300_000, maxMessagesPerHour: 8, jitterMs: 60_000 },
browser: { dryRun: false },
reddit: { prioritizeRecentPosts: true, recentWindowMinutes: 60 },
subreddits: [{ name: 'example', type: 'chat', weight: 2, tone: 'direct' }],
subreddits: [{ name: 'example', enabled: true, type: 'chat', weight: 2, tone: 'direct' }],
tones: ['default', 'direct'],
};
expect(ConfigResponseSchema.parse(payload)).toEqual(payload);
@@ -174,6 +174,7 @@ describe('dashboard endpoint contracts', () => {
id: 'post-1', subreddit: 'example', title: 'Example',
url: 'https://www.reddit.com/r/example/comments/post-1/', imageUrl: 'https://i.redd.it/example.jpg', sentAt: 1_700_000_000_000,
},
automation: { turnsUsed: 1, remainingTurns: 2, status: 'active', handoffReason: null },
syncInProgress: null,
}).success).toBe(true);
expect(ChatsResponseSchema.safeParse([{ ...chat, messages: [{ sender: 'alice' }] }]).success).toBe(false);