feat: add smart notification routing with device-aware heartbeats and push support

This commit is contained in:
Mohamed Boudra
2026-01-13 16:07:34 +07:00
parent 4803589ea1
commit 34a49c147f
13 changed files with 1189 additions and 167 deletions
+9
View File
@@ -514,8 +514,10 @@ export const ClearAgentAttentionMessageSchema = z.object({
export const ClientHeartbeatMessageSchema = z.object({
type: z.literal("client_heartbeat"),
deviceType: z.enum(["web", "mobile"]),
focusedAgentId: z.string().nullable(),
lastActivityAt: z.string(),
appVisible: z.boolean(),
});
export const ListCommandsRequestSchema = z.object({
@@ -524,6 +526,11 @@ export const ListCommandsRequestSchema = z.object({
requestId: z.string(),
});
export const RegisterPushTokenMessageSchema = z.object({
type: z.literal("register_push_token"),
token: z.string(),
});
export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
UserTextMessageSchema,
RealtimeAudioChunkMessageSchema,
@@ -553,6 +560,7 @@ export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
ClearAgentAttentionMessageSchema,
ClientHeartbeatMessageSchema,
ListCommandsRequestSchema,
RegisterPushTokenMessageSchema,
]);
export type SessionInboundMessage = z.infer<typeof SessionInboundMessageSchema>;
@@ -967,6 +975,7 @@ export type ClearAgentAttentionMessage = z.infer<typeof ClearAgentAttentionMessa
export type ClientHeartbeatMessage = z.infer<typeof ClientHeartbeatMessageSchema>;
export type ListCommandsRequest = z.infer<typeof ListCommandsRequestSchema>;
export type ListCommandsResponse = z.infer<typeof ListCommandsResponseSchema>;
export type RegisterPushTokenMessage = z.infer<typeof RegisterPushTokenMessageSchema>;
// ============================================================================
// WebSocket Level Messages (wraps session messages)