@canonmsg/backend-contracts 1.7.1 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agentBehaviorPolicy.d.ts +86 -45
- package/dist/agentBehaviorPolicy.js +53 -0
- package/dist/bridgeLocal.d.ts +1729 -0
- package/dist/bridgeLocal.js +673 -0
- package/dist/cjs/agentBehaviorPolicy.js +54 -1
- package/dist/cjs/bridgeLocal.js +676 -0
- package/dist/cjs/contactRequest.js +30 -0
- package/dist/cjs/controlSignals.js +44 -0
- package/dist/cjs/endpointRegistry.js +264 -0
- package/dist/cjs/hitl.js +171 -0
- package/dist/cjs/inboundFrame.js +92 -0
- package/dist/cjs/index.js +8 -0
- package/dist/cjs/media.js +13 -0
- package/dist/cjs/message.js +64 -0
- package/dist/cjs/restEndpoints.js +220 -0
- package/dist/cjs/runtimeCardFields.js +58 -1
- package/dist/cjs/sendContextual.js +92 -0
- package/dist/cjs/sseEvents.js +298 -0
- package/dist/cjs/turnProtocol.js +41 -1
- package/dist/contactRequest.d.ts +42 -23
- package/dist/contactRequest.js +29 -0
- package/dist/controlSignals.d.ts +55 -0
- package/dist/controlSignals.js +41 -0
- package/dist/endpointRegistry.d.ts +13 -0
- package/dist/endpointRegistry.js +261 -0
- package/dist/hitl.d.ts +303 -0
- package/dist/hitl.js +168 -0
- package/dist/inboundFrame.d.ts +229 -0
- package/dist/inboundFrame.js +89 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/media.d.ts +24 -11
- package/dist/media.js +12 -0
- package/dist/message.d.ts +133 -50
- package/dist/message.js +64 -1
- package/dist/restEndpoints.d.ts +496 -0
- package/dist/restEndpoints.js +217 -0
- package/dist/runtimeCardFields.d.ts +112 -39
- package/dist/runtimeCardFields.js +57 -0
- package/dist/schemas/agent-behavior-settings-record.schema.json +48 -0
- package/dist/schemas/bridge-connection-state-notification.schema.json +19 -0
- package/dist/schemas/bridge-get-attachment-params.schema.json +24 -0
- package/dist/schemas/bridge-get-attachment-result.schema.json +20 -0
- package/dist/schemas/bridge-hello-params.schema.json +42 -0
- package/dist/schemas/bridge-hello-result.schema.json +105 -0
- package/dist/schemas/bridge-hitl-state.schema.json +38 -0
- package/dist/schemas/bridge-ok-result.schema.json +15 -0
- package/dist/schemas/bridge-ready-notification.schema.json +79 -0
- package/dist/schemas/bridge-resync-reason.schema.json +9 -0
- package/dist/schemas/bridge-resync.schema.json +18 -0
- package/dist/schemas/bridge-rpc-error.schema.json +19 -0
- package/dist/schemas/bridge-rpc-id.schema.json +12 -0
- package/dist/schemas/bridge-rpc-notification.schema.json +20 -0
- package/dist/schemas/bridge-rpc-request.schema.json +31 -0
- package/dist/schemas/bridge-rpc-response.schema.json +81 -0
- package/dist/schemas/bridge-status-result.schema.json +76 -0
- package/dist/schemas/bridge-upload-media-params.schema.json +28 -0
- package/dist/schemas/bridge-upstream-state.schema.json +10 -0
- package/dist/schemas/contacts-response.schema.json +52 -0
- package/dist/schemas/control-channel-key.schema.json +10 -0
- package/dist/schemas/control-primitive-event.schema.json +30 -0
- package/dist/schemas/control-primitive-map.schema.json +15 -0
- package/dist/schemas/control-session-event.schema.json +26 -0
- package/dist/schemas/control-session-node.schema.json +11 -0
- package/dist/schemas/control-signal-event.schema.json +35 -0
- package/dist/schemas/control-signal-node.schema.json +22 -0
- package/dist/schemas/control-signal-type.schema.json +10 -0
- package/dist/schemas/conversations-response.schema.json +127 -0
- package/dist/schemas/create-contact-request-request.schema.json +17 -0
- package/dist/schemas/create-contact-request-response.schema.json +51 -0
- package/dist/schemas/create-conversation-request.schema.json +82 -0
- package/dist/schemas/create-conversation-response.schema.json +29 -0
- package/dist/schemas/delete-message-response.schema.json +11 -0
- package/dist/schemas/delivery-intent.schema.json +11 -0
- package/dist/schemas/forward-message-request.schema.json +25 -0
- package/dist/schemas/forward-message-response.schema.json +35 -0
- package/dist/schemas/forwarded-from.schema.json +18 -0
- package/dist/schemas/get-messages-query.schema.json +17 -0
- package/dist/schemas/hitl-approval-category.schema.json +15 -0
- package/dist/schemas/hitl-approval-detail.schema.json +21 -0
- package/dist/schemas/hitl-approval-outcome-record.schema.json +33 -0
- package/dist/schemas/hitl-approval-reply-record.schema.json +57 -0
- package/dist/schemas/hitl-approval-request-record.schema.json +105 -0
- package/dist/schemas/hitl-approval-risk.schema.json +11 -0
- package/dist/schemas/hitl-card-outcome-record.schema.json +48 -0
- package/dist/schemas/hitl-card-reply-record.schema.json +46 -0
- package/dist/schemas/hitl-card-request-record.schema.json +73 -0
- package/dist/schemas/hitl-input-answers.schema.json +23 -0
- package/dist/schemas/hitl-input-kind.schema.json +10 -0
- package/dist/schemas/hitl-input-outcome-record.schema.json +46 -0
- package/dist/schemas/hitl-input-question.schema.json +54 -0
- package/dist/schemas/hitl-input-reply-record.schema.json +44 -0
- package/dist/schemas/hitl-input-request-record.schema.json +134 -0
- package/dist/schemas/hitl-pending.schema.json +31 -0
- package/dist/schemas/hitl-request-accepted.schema.json +18 -0
- package/dist/schemas/hitl-request-kind.schema.json +10 -0
- package/dist/schemas/hitl-resolution-status.schema.json +10 -0
- package/dist/schemas/hitl-resolution.schema.json +38 -0
- package/dist/schemas/hitl-session-rule.schema.json +32 -0
- package/dist/schemas/inbound-disposition.schema.json +13 -0
- package/dist/schemas/inbound-frame-attachment-v1.schema.json +94 -0
- package/dist/schemas/inbound-frame-contact-card-v1.schema.json +59 -0
- package/dist/schemas/inbound-frame-group-context-v1.schema.json +96 -0
- package/dist/schemas/inbound-frame-reply-context-v1.schema.json +261 -0
- package/dist/schemas/inbound-frame-shape-v1.schema.json +12 -0
- package/dist/schemas/inbound-frame-v1.schema.json +506 -0
- package/dist/schemas/mark-read-response.schema.json +11 -0
- package/dist/schemas/media-attachment-kind.schema.json +11 -0
- package/dist/schemas/media-attachment.schema.json +42 -0
- package/dist/schemas/messages-page-response.schema.json +290 -0
- package/dist/schemas/participation-decision-input.schema.json +44 -0
- package/dist/schemas/participation-history-message.schema.json +23 -0
- package/dist/schemas/participation-history-snapshot.schema.json +37 -0
- package/dist/schemas/participation-style.schema.json +13 -0
- package/dist/schemas/react-request.schema.json +22 -0
- package/dist/schemas/react-response.schema.json +35 -0
- package/dist/schemas/resolve-admission-request.schema.json +30 -0
- package/dist/schemas/resolve-admission-response.schema.json +129 -0
- package/dist/schemas/resolved-agent-behavior-policy-record.schema.json +81 -0
- package/dist/schemas/rest-contact.schema.json +40 -0
- package/dist/schemas/rest-conversation.schema.json +115 -0
- package/dist/schemas/rest-message.schema.json +252 -0
- package/dist/schemas/rest-ok-response.schema.json +11 -0
- package/dist/schemas/rest-session-selection.schema.json +40 -0
- package/dist/schemas/runtime-card-field-choice.schema.json +23 -0
- package/dist/schemas/runtime-card-field-type.schema.json +17 -0
- package/dist/schemas/runtime-card-field.schema.json +180 -0
- package/dist/schemas/runtime-card-line-item-column-type.schema.json +12 -0
- package/dist/schemas/runtime-card-line-item-column.schema.json +74 -0
- package/dist/schemas/send-contextual-deferred-response.schema.json +39 -0
- package/dist/schemas/send-contextual-messaged-response.schema.json +42 -0
- package/dist/schemas/send-contextual-request.schema.json +103 -0
- package/dist/schemas/send-contextual-response.schema.json +105 -0
- package/dist/schemas/send-contextual-self-context.schema.json +19 -0
- package/dist/schemas/send-contextual-state-response.schema.json +24 -0
- package/dist/schemas/send-message-request.schema.json +106 -0
- package/dist/schemas/send-message-response.schema.json +14 -0
- package/dist/schemas/sender-type.schema.json +9 -0
- package/dist/schemas/serialize-message-input.schema.json +29 -0
- package/dist/schemas/serialized-agent-client-type.schema.json +12 -0
- package/dist/schemas/serialized-contact-card.schema.json +65 -0
- package/dist/schemas/serialized-contact-request-status.schema.json +11 -0
- package/dist/schemas/serialized-contact-request.schema.json +157 -0
- package/dist/schemas/serialized-content-type.schema.json +13 -0
- package/dist/schemas/serialized-message.schema.json +249 -0
- package/dist/schemas/serialized-reactions.schema.json +14 -0
- package/dist/schemas/serialized-sender-type.schema.json +9 -0
- package/dist/schemas/set-streaming-request.schema.json +67 -0
- package/dist/schemas/set-typing-request.schema.json +25 -0
- package/dist/schemas/sse-access-policy.schema.json +10 -0
- package/dist/schemas/sse-agent-context-payload.schema.json +57 -0
- package/dist/schemas/sse-connected-payload.schema.json +18 -0
- package/dist/schemas/sse-contact-payload.schema.json +40 -0
- package/dist/schemas/sse-contact-removed-payload.schema.json +14 -0
- package/dist/schemas/sse-contact-request-payload.schema.json +157 -0
- package/dist/schemas/sse-conversation-updated-payload.schema.json +48 -0
- package/dist/schemas/sse-error-payload.schema.json +23 -0
- package/dist/schemas/sse-event-envelope.schema.json +42 -0
- package/dist/schemas/sse-event-family.schema.json +12 -0
- package/dist/schemas/sse-event-type.schema.json +28 -0
- package/dist/schemas/sse-heartbeat-payload.schema.json +14 -0
- package/dist/schemas/sse-membership-change.schema.json +28 -0
- package/dist/schemas/sse-message-created-payload.schema.json +414 -0
- package/dist/schemas/sse-message-deleted-payload.schema.json +18 -0
- package/dist/schemas/sse-message-updated-payload.schema.json +46 -0
- package/dist/schemas/sse-presence-payload.schema.json +21 -0
- package/dist/schemas/sse-provenance.schema.json +64 -0
- package/dist/schemas/sse-replay-expired-payload.schema.json +21 -0
- package/dist/schemas/sse-runtime-control-kind.schema.json +13 -0
- package/dist/schemas/sse-runtime-control-payload.schema.json +44 -0
- package/dist/schemas/sse-runtime-updated-payload.schema.json +78 -0
- package/dist/schemas/sse-self-context.schema.json +45 -0
- package/dist/schemas/sse-turn-dispatch.schema.json +29 -0
- package/dist/schemas/sse-turn-updated-payload.schema.json +33 -0
- package/dist/schemas/sse-typing-payload.schema.json +32 -0
- package/dist/schemas/sse-voice-session-event-payload.schema.json +170 -0
- package/dist/schemas/sse-voice-session.schema.json +157 -0
- package/dist/schemas/trigger-decision.schema.json +27 -0
- package/dist/schemas/turn-lifecycle-state.schema.json +14 -0
- package/dist/schemas/turn-message-semantics.schema.json +10 -0
- package/dist/schemas/turn-metadata.schema.json +56 -0
- package/dist/schemas/turn-state-like.schema.json +39 -0
- package/dist/schemas/update-disposition-request.schema.json +22 -0
- package/dist/schemas/upload-media-request.schema.json +25 -0
- package/dist/schemas/upload-media-response.schema.json +55 -0
- package/dist/sendContextual.d.ts +114 -0
- package/dist/sendContextual.js +89 -0
- package/dist/sseEvents.d.ts +494 -0
- package/dist/sseEvents.js +295 -0
- package/dist/turnProtocol.d.ts +91 -24
- package/dist/turnProtocol.js +40 -0
- package/package.json +8 -5
package/dist/message.d.ts
CHANGED
|
@@ -1,51 +1,134 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const SerializedSenderTypeSchema: z.ZodEnum<{
|
|
3
|
+
human: "human";
|
|
4
|
+
ai_agent: "ai_agent";
|
|
5
|
+
}>;
|
|
6
|
+
export type SerializedSenderType = z.infer<typeof SerializedSenderTypeSchema>;
|
|
7
|
+
export declare const SerializedAgentClientTypeSchema: z.ZodEnum<{
|
|
8
|
+
"claude-code": "claude-code";
|
|
9
|
+
openclaw: "openclaw";
|
|
10
|
+
codex: "codex";
|
|
11
|
+
hermes: "hermes";
|
|
12
|
+
generic: "generic";
|
|
13
|
+
}>;
|
|
14
|
+
export type SerializedAgentClientType = z.infer<typeof SerializedAgentClientTypeSchema>;
|
|
15
|
+
export declare const SerializedContentTypeSchema: z.ZodEnum<{
|
|
16
|
+
file: "file";
|
|
17
|
+
image: "image";
|
|
18
|
+
audio: "audio";
|
|
19
|
+
video: "video";
|
|
20
|
+
text: "text";
|
|
21
|
+
contact_card: "contact_card";
|
|
22
|
+
}>;
|
|
23
|
+
export type SerializedContentType = z.infer<typeof SerializedContentTypeSchema>;
|
|
24
|
+
export declare const ForwardedFromSchema: z.ZodObject<{
|
|
25
|
+
sourceConversationId: z.ZodString;
|
|
26
|
+
messageId: z.ZodString;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export type ForwardedFrom = z.infer<typeof ForwardedFromSchema>;
|
|
29
|
+
export declare const SerializedReactionsSchema: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
|
|
30
|
+
export type SerializedReactions = z.infer<typeof SerializedReactionsSchema>;
|
|
31
|
+
export declare const SerializedContactCardSchema: z.ZodObject<{
|
|
32
|
+
userId: z.ZodString;
|
|
33
|
+
canonContactId: z.ZodOptional<z.ZodString>;
|
|
34
|
+
displayName: z.ZodString;
|
|
35
|
+
avatarUrl: z.ZodNullable<z.ZodString>;
|
|
36
|
+
userType: z.ZodEnum<{
|
|
37
|
+
human: "human";
|
|
38
|
+
ai_agent: "ai_agent";
|
|
39
|
+
}>;
|
|
40
|
+
clientType: z.ZodOptional<z.ZodEnum<{
|
|
41
|
+
"claude-code": "claude-code";
|
|
42
|
+
openclaw: "openclaw";
|
|
43
|
+
codex: "codex";
|
|
44
|
+
hermes: "hermes";
|
|
45
|
+
generic: "generic";
|
|
46
|
+
}>>;
|
|
47
|
+
about: z.ZodOptional<z.ZodString>;
|
|
48
|
+
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
49
|
+
ownerId: z.ZodOptional<z.ZodString>;
|
|
50
|
+
ownerName: z.ZodOptional<z.ZodString>;
|
|
51
|
+
lifecycleState: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
export type SerializedContactCard = z.infer<typeof SerializedContactCardSchema>;
|
|
54
|
+
export declare const SerializedMessageSchema: z.ZodObject<{
|
|
55
|
+
id: z.ZodString;
|
|
56
|
+
senderId: z.ZodString;
|
|
57
|
+
senderName: z.ZodOptional<z.ZodString>;
|
|
58
|
+
senderType: z.ZodEnum<{
|
|
59
|
+
human: "human";
|
|
60
|
+
ai_agent: "ai_agent";
|
|
61
|
+
}>;
|
|
62
|
+
isOwner: z.ZodBoolean;
|
|
63
|
+
contentType: z.ZodEnum<{
|
|
64
|
+
file: "file";
|
|
65
|
+
image: "image";
|
|
66
|
+
audio: "audio";
|
|
67
|
+
video: "video";
|
|
68
|
+
text: "text";
|
|
69
|
+
contact_card: "contact_card";
|
|
70
|
+
}>;
|
|
71
|
+
text: z.ZodNullable<z.ZodString>;
|
|
72
|
+
attachments: z.ZodArray<z.ZodObject<{
|
|
73
|
+
kind: z.ZodEnum<{
|
|
74
|
+
file: "file";
|
|
75
|
+
image: "image";
|
|
76
|
+
audio: "audio";
|
|
77
|
+
video: "video";
|
|
78
|
+
}>;
|
|
79
|
+
url: z.ZodString;
|
|
80
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
81
|
+
fileName: z.ZodOptional<z.ZodString>;
|
|
82
|
+
sizeBytes: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
85
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
86
|
+
}, z.core.$strip>>;
|
|
87
|
+
mentions: z.ZodArray<z.ZodString>;
|
|
88
|
+
replyTo: z.ZodNullable<z.ZodString>;
|
|
89
|
+
replyToPosition: z.ZodNullable<z.ZodNumber>;
|
|
90
|
+
forwarded: z.ZodOptional<z.ZodBoolean>;
|
|
91
|
+
forwardedFrom: z.ZodOptional<z.ZodObject<{
|
|
92
|
+
sourceConversationId: z.ZodString;
|
|
93
|
+
messageId: z.ZodString;
|
|
94
|
+
}, z.core.$strip>>;
|
|
95
|
+
status: z.ZodEnum<{
|
|
96
|
+
sent: "sent";
|
|
97
|
+
read: "read";
|
|
98
|
+
}>;
|
|
99
|
+
createdAt: z.ZodString;
|
|
100
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
101
|
+
contactCard: z.ZodOptional<z.ZodObject<{
|
|
102
|
+
userId: z.ZodString;
|
|
103
|
+
canonContactId: z.ZodOptional<z.ZodString>;
|
|
104
|
+
displayName: z.ZodString;
|
|
105
|
+
avatarUrl: z.ZodNullable<z.ZodString>;
|
|
106
|
+
userType: z.ZodEnum<{
|
|
107
|
+
human: "human";
|
|
108
|
+
ai_agent: "ai_agent";
|
|
109
|
+
}>;
|
|
110
|
+
clientType: z.ZodOptional<z.ZodEnum<{
|
|
111
|
+
"claude-code": "claude-code";
|
|
112
|
+
openclaw: "openclaw";
|
|
113
|
+
codex: "codex";
|
|
114
|
+
hermes: "hermes";
|
|
115
|
+
generic: "generic";
|
|
116
|
+
}>>;
|
|
117
|
+
about: z.ZodOptional<z.ZodString>;
|
|
118
|
+
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
119
|
+
ownerId: z.ZodOptional<z.ZodString>;
|
|
120
|
+
ownerName: z.ZodOptional<z.ZodString>;
|
|
121
|
+
lifecycleState: z.ZodOptional<z.ZodString>;
|
|
122
|
+
}, z.core.$strip>>;
|
|
123
|
+
runtimeCard: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
124
|
+
reactions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
125
|
+
}, z.core.$strip>;
|
|
126
|
+
export type SerializedMessage = z.infer<typeof SerializedMessageSchema>;
|
|
127
|
+
export declare const SerializeMessageInputSchema: z.ZodObject<{
|
|
128
|
+
id: z.ZodString;
|
|
129
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
130
|
+
senderName: z.ZodOptional<z.ZodString>;
|
|
131
|
+
isOwner: z.ZodBoolean;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
export type SerializeMessageInput = z.infer<typeof SerializeMessageInputSchema>;
|
|
51
134
|
export declare function serializeStoredMessage(input: SerializeMessageInput): SerializedMessage;
|
package/dist/message.js
CHANGED
|
@@ -1,5 +1,68 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MediaAttachmentSchema, normalizeStoredAttachments } from './media.js';
|
|
2
3
|
import { decodeStoredRuntimeCard } from './runtimeCardStorage.js';
|
|
4
|
+
export const SerializedSenderTypeSchema = z.enum(['human', 'ai_agent']);
|
|
5
|
+
export const SerializedAgentClientTypeSchema = z.enum([
|
|
6
|
+
'claude-code',
|
|
7
|
+
'openclaw',
|
|
8
|
+
'codex',
|
|
9
|
+
'hermes',
|
|
10
|
+
'generic',
|
|
11
|
+
]);
|
|
12
|
+
export const SerializedContentTypeSchema = z.enum([
|
|
13
|
+
'text',
|
|
14
|
+
'image',
|
|
15
|
+
'audio',
|
|
16
|
+
'video',
|
|
17
|
+
'file',
|
|
18
|
+
'contact_card',
|
|
19
|
+
]);
|
|
20
|
+
export const ForwardedFromSchema = z.object({
|
|
21
|
+
sourceConversationId: z.string(),
|
|
22
|
+
messageId: z.string(),
|
|
23
|
+
});
|
|
24
|
+
export const SerializedReactionsSchema = z.record(z.string(), z.array(z.string()));
|
|
25
|
+
export const SerializedContactCardSchema = z.object({
|
|
26
|
+
userId: z.string(),
|
|
27
|
+
canonContactId: z.string().optional(),
|
|
28
|
+
displayName: z.string(),
|
|
29
|
+
avatarUrl: z.string().nullable(),
|
|
30
|
+
userType: SerializedSenderTypeSchema,
|
|
31
|
+
clientType: SerializedAgentClientTypeSchema.optional(),
|
|
32
|
+
about: z.string().optional(),
|
|
33
|
+
isActive: z.boolean().optional(),
|
|
34
|
+
ownerId: z.string().optional(),
|
|
35
|
+
ownerName: z.string().optional(),
|
|
36
|
+
lifecycleState: z.string().optional(),
|
|
37
|
+
});
|
|
38
|
+
export const SerializedMessageSchema = z.object({
|
|
39
|
+
id: z.string(),
|
|
40
|
+
senderId: z.string(),
|
|
41
|
+
senderName: z.string().optional(),
|
|
42
|
+
senderType: SerializedSenderTypeSchema,
|
|
43
|
+
isOwner: z.boolean(),
|
|
44
|
+
contentType: SerializedContentTypeSchema,
|
|
45
|
+
text: z.string().nullable(),
|
|
46
|
+
attachments: z.array(MediaAttachmentSchema),
|
|
47
|
+
mentions: z.array(z.string()),
|
|
48
|
+
replyTo: z.string().nullable(),
|
|
49
|
+
replyToPosition: z.number().nullable(),
|
|
50
|
+
forwarded: z.boolean().optional(),
|
|
51
|
+
forwardedFrom: ForwardedFromSchema.optional(),
|
|
52
|
+
status: z.enum(['sent', 'read']),
|
|
53
|
+
createdAt: z.string(),
|
|
54
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
55
|
+
contactCard: SerializedContactCardSchema.optional(),
|
|
56
|
+
/** Durable canon.card.v1 runtime card content, passed through opaquely. */
|
|
57
|
+
runtimeCard: z.record(z.string(), z.unknown()).optional(),
|
|
58
|
+
reactions: SerializedReactionsSchema.optional(),
|
|
59
|
+
});
|
|
60
|
+
export const SerializeMessageInputSchema = z.object({
|
|
61
|
+
id: z.string(),
|
|
62
|
+
data: z.record(z.string(), z.unknown()),
|
|
63
|
+
senderName: z.string().optional(),
|
|
64
|
+
isOwner: z.boolean(),
|
|
65
|
+
});
|
|
3
66
|
function isRecord(value) {
|
|
4
67
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
5
68
|
}
|