feat(chat): migrate chat protocol to lock detail

This commit is contained in:
2026-06-24 14:06:30 +08:00
parent c280a3c1ea
commit 42c03f8901
34 changed files with 609 additions and 373 deletions
+34
View File
@@ -0,0 +1,34 @@
/**
* Chat wire payload fragments shared by send response and history messages.
*/
import { z } from "zod";
export const ChatImageSchema = z
.object({
type: z.string().nullable().default(null),
url: z.string().nullable().default(null),
})
.default({ type: null, url: null });
export const ChatLockDetailSchema = z
.object({
locked: z.boolean().default(false),
showContent: z.boolean().default(true),
showUpgrade: z.boolean().default(false),
reason: z.string().nullable().default(null),
hint: z.string().nullable().default(null),
detail: z.record(z.string(), z.unknown()).nullable().default(null),
})
.default({
locked: false,
showContent: true,
showUpgrade: false,
reason: null,
hint: null,
detail: null,
});
export type ChatImageInput = z.input<typeof ChatImageSchema>;
export type ChatImageData = z.output<typeof ChatImageSchema>;
export type ChatLockDetailInput = z.input<typeof ChatLockDetailSchema>;
export type ChatLockDetailData = z.output<typeof ChatLockDetailSchema>;