@canonmsg/backend-contracts 1.2.0 → 1.3.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/cjs/media.js CHANGED
@@ -11,6 +11,8 @@ function inferMediaAttachmentKind(mimeType) {
11
11
  return 'image';
12
12
  if (mimeType.startsWith('audio/'))
13
13
  return 'audio';
14
+ if (mimeType.startsWith('video/'))
15
+ return 'video';
14
16
  return 'file';
15
17
  }
16
18
  function getStoredFileExtension(input) {
@@ -26,6 +28,10 @@ function getStoredFileExtension(input) {
26
28
  'audio/mpeg': 'mp3',
27
29
  'audio/webm': 'webm',
28
30
  'audio/ogg': 'ogg',
31
+ 'video/mp4': 'mp4',
32
+ 'video/quicktime': 'mov',
33
+ 'video/webm': 'webm',
34
+ 'video/x-m4v': 'm4v',
29
35
  'application/pdf': 'pdf',
30
36
  'text/plain': 'txt',
31
37
  'application/json': 'json',
@@ -63,6 +69,7 @@ function normalizeStoredAttachments(value) {
63
69
  const candidate = item;
64
70
  if (candidate.kind !== 'image'
65
71
  && candidate.kind !== 'audio'
72
+ && candidate.kind !== 'video'
66
73
  && candidate.kind !== 'file') {
67
74
  return null;
68
75
  }
@@ -97,5 +104,7 @@ function describeAttachment(attachment) {
97
104
  return '📷 Image';
98
105
  if (attachment.kind === 'audio')
99
106
  return '🎤 Voice message';
107
+ if (attachment.kind === 'video')
108
+ return '🎬 Video';
100
109
  return attachment.fileName ? `📎 ${attachment.fileName}` : '📎 File';
101
110
  }
@@ -59,6 +59,7 @@ function normalizeContentType(value) {
59
59
  if (value === 'text'
60
60
  || value === 'image'
61
61
  || value === 'audio'
62
+ || value === 'video'
62
63
  || value === 'file'
63
64
  || value === 'contact_card') {
64
65
  return value;
package/dist/media.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type MediaAttachmentKind = 'image' | 'audio' | 'file';
1
+ export type MediaAttachmentKind = 'image' | 'audio' | 'video' | 'file';
2
2
  export interface MediaAttachment {
3
3
  kind: MediaAttachmentKind;
4
4
  url: string;
package/dist/media.js CHANGED
@@ -3,6 +3,8 @@ export function inferMediaAttachmentKind(mimeType) {
3
3
  return 'image';
4
4
  if (mimeType.startsWith('audio/'))
5
5
  return 'audio';
6
+ if (mimeType.startsWith('video/'))
7
+ return 'video';
6
8
  return 'file';
7
9
  }
8
10
  export function getStoredFileExtension(input) {
@@ -18,6 +20,10 @@ export function getStoredFileExtension(input) {
18
20
  'audio/mpeg': 'mp3',
19
21
  'audio/webm': 'webm',
20
22
  'audio/ogg': 'ogg',
23
+ 'video/mp4': 'mp4',
24
+ 'video/quicktime': 'mov',
25
+ 'video/webm': 'webm',
26
+ 'video/x-m4v': 'm4v',
21
27
  'application/pdf': 'pdf',
22
28
  'text/plain': 'txt',
23
29
  'application/json': 'json',
@@ -55,6 +61,7 @@ export function normalizeStoredAttachments(value) {
55
61
  const candidate = item;
56
62
  if (candidate.kind !== 'image'
57
63
  && candidate.kind !== 'audio'
64
+ && candidate.kind !== 'video'
58
65
  && candidate.kind !== 'file') {
59
66
  return null;
60
67
  }
@@ -89,5 +96,7 @@ export function describeAttachment(attachment) {
89
96
  return '📷 Image';
90
97
  if (attachment.kind === 'audio')
91
98
  return '🎤 Voice message';
99
+ if (attachment.kind === 'video')
100
+ return '🎬 Video';
92
101
  return attachment.fileName ? `📎 ${attachment.fileName}` : '📎 File';
93
102
  }
package/dist/message.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { MediaAttachment } from './media.js';
2
2
  export type SerializedSenderType = 'human' | 'ai_agent';
3
3
  export type SerializedAgentClientType = 'claude-code' | 'openclaw' | 'codex' | 'hermes' | 'generic';
4
- export type SerializedContentType = 'text' | 'image' | 'audio' | 'file' | 'contact_card';
4
+ export type SerializedContentType = 'text' | 'image' | 'audio' | 'video' | 'file' | 'contact_card';
5
5
  export interface ForwardedFrom {
6
6
  sourceConversationId: string;
7
7
  messageId: string;
package/dist/message.js CHANGED
@@ -56,6 +56,7 @@ function normalizeContentType(value) {
56
56
  if (value === 'text'
57
57
  || value === 'image'
58
58
  || value === 'audio'
59
+ || value === 'video'
59
60
  || value === 'file'
60
61
  || value === 'contact_card') {
61
62
  return value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonmsg/backend-contracts",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Canon backend contract helpers shared by Functions and stream-service",
5
5
  "type": "module",
6
6
  "main": "dist/cjs/index.js",