@canonmsg/backend-contracts 0.2.0 → 0.2.1
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/message.js +14 -0
- package/dist/message.d.ts +2 -0
- package/dist/message.js +14 -0
- package/package.json +1 -1
package/dist/cjs/message.js
CHANGED
|
@@ -30,6 +30,15 @@ function normalizeSenderType(value, fallback) {
|
|
|
30
30
|
return 'ai_agent';
|
|
31
31
|
return 'human';
|
|
32
32
|
}
|
|
33
|
+
function normalizeAgentClientType(value) {
|
|
34
|
+
if (value === 'claude-code'
|
|
35
|
+
|| value === 'openclaw'
|
|
36
|
+
|| value === 'codex'
|
|
37
|
+
|| value === 'generic') {
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
33
42
|
function normalizeContentType(value, attachments) {
|
|
34
43
|
if (value === 'text'
|
|
35
44
|
|| value === 'image'
|
|
@@ -69,6 +78,11 @@ function normalizeContactCard(value) {
|
|
|
69
78
|
};
|
|
70
79
|
if (typeof value.about === 'string')
|
|
71
80
|
card.about = value.about;
|
|
81
|
+
const clientType = userType === 'ai_agent'
|
|
82
|
+
? normalizeAgentClientType(value.clientType)
|
|
83
|
+
: undefined;
|
|
84
|
+
if (clientType)
|
|
85
|
+
card.clientType = clientType;
|
|
72
86
|
if (typeof value.isActive === 'boolean')
|
|
73
87
|
card.isActive = value.isActive;
|
|
74
88
|
if (typeof value.ownerId === 'string')
|
package/dist/message.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MediaAttachment } from './media.js';
|
|
2
2
|
export type SerializedSenderType = 'human' | 'ai_agent';
|
|
3
|
+
export type SerializedAgentClientType = 'claude-code' | 'openclaw' | 'codex' | 'generic';
|
|
3
4
|
export type SerializedContentType = 'text' | 'image' | 'audio' | 'file' | 'contact_card';
|
|
4
5
|
export interface ForwardedFrom {
|
|
5
6
|
sourceConversationId: string;
|
|
@@ -10,6 +11,7 @@ export interface SerializedContactCard {
|
|
|
10
11
|
displayName: string;
|
|
11
12
|
avatarUrl: string | null;
|
|
12
13
|
userType: SerializedSenderType;
|
|
14
|
+
clientType?: SerializedAgentClientType;
|
|
13
15
|
about?: string;
|
|
14
16
|
isActive?: boolean;
|
|
15
17
|
ownerId?: string;
|
package/dist/message.js
CHANGED
|
@@ -27,6 +27,15 @@ function normalizeSenderType(value, fallback) {
|
|
|
27
27
|
return 'ai_agent';
|
|
28
28
|
return 'human';
|
|
29
29
|
}
|
|
30
|
+
function normalizeAgentClientType(value) {
|
|
31
|
+
if (value === 'claude-code'
|
|
32
|
+
|| value === 'openclaw'
|
|
33
|
+
|| value === 'codex'
|
|
34
|
+
|| value === 'generic') {
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
30
39
|
function normalizeContentType(value, attachments) {
|
|
31
40
|
if (value === 'text'
|
|
32
41
|
|| value === 'image'
|
|
@@ -66,6 +75,11 @@ function normalizeContactCard(value) {
|
|
|
66
75
|
};
|
|
67
76
|
if (typeof value.about === 'string')
|
|
68
77
|
card.about = value.about;
|
|
78
|
+
const clientType = userType === 'ai_agent'
|
|
79
|
+
? normalizeAgentClientType(value.clientType)
|
|
80
|
+
: undefined;
|
|
81
|
+
if (clientType)
|
|
82
|
+
card.clientType = clientType;
|
|
69
83
|
if (typeof value.isActive === 'boolean')
|
|
70
84
|
card.isActive = value.isActive;
|
|
71
85
|
if (typeof value.ownerId === 'string')
|