@canonmsg/agent-sdk 0.8.0 → 0.8.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/README.md +1 -1
- package/dist/media.d.ts +2 -2
- package/dist/media.js +1 -19
- package/dist/realtime.js +6 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -117,7 +117,7 @@ This is the easiest way to build agents that need per-conversation memory or que
|
|
|
117
117
|
|
|
118
118
|
## Media
|
|
119
119
|
|
|
120
|
-
Normalized Canon messages always expose `attachments[]` as the canonical media contract.
|
|
120
|
+
Normalized Canon messages always expose `attachments[]` as the single canonical media contract. Legacy flat fields (`imageUrl`, `audioUrl`, `audioDurationMs`) are no longer part of the message shape — agents must consume `attachments` directly.
|
|
121
121
|
|
|
122
122
|
Use the handler `media` helpers when you need the actual file bytes:
|
|
123
123
|
|
package/dist/media.d.ts
CHANGED
|
@@ -39,11 +39,11 @@ export interface AnthropicImageBlock {
|
|
|
39
39
|
data: string;
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
export declare function getMessageAttachments(message: Pick<CanonMessage, 'attachments'
|
|
42
|
+
export declare function getMessageAttachments(message: Pick<CanonMessage, 'attachments'>): MediaAttachment[];
|
|
43
43
|
export declare function materializeAttachment(attachment: MediaAttachment, options: MaterializeMediaOptions & {
|
|
44
44
|
index?: number;
|
|
45
45
|
}): Promise<MaterializedCanonAttachment>;
|
|
46
|
-
export declare function materializeMessageMedia(message: Pick<CanonMessage, 'id' | 'attachments'
|
|
46
|
+
export declare function materializeMessageMedia(message: Pick<CanonMessage, 'id' | 'attachments'>, options: Omit<MaterializeMediaOptions, 'messageId'>): Promise<MaterializedCanonAttachment[]>;
|
|
47
47
|
export declare function inferUploadMimeType(filePath: string, overrideMimeType?: string): string;
|
|
48
48
|
export declare function uploadMediaFile(client: CanonClient, conversationId: string, filePath: string, options?: UploadMediaFileOptions): Promise<{
|
|
49
49
|
url: string;
|
package/dist/media.js
CHANGED
|
@@ -94,25 +94,7 @@ async function fileExists(path) {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
export function getMessageAttachments(message) {
|
|
97
|
-
|
|
98
|
-
return message.attachments;
|
|
99
|
-
}
|
|
100
|
-
if (message.audioUrl) {
|
|
101
|
-
return [{
|
|
102
|
-
kind: 'audio',
|
|
103
|
-
url: message.audioUrl,
|
|
104
|
-
...(typeof message.audioDurationMs === 'number'
|
|
105
|
-
? { durationMs: message.audioDurationMs }
|
|
106
|
-
: {}),
|
|
107
|
-
}];
|
|
108
|
-
}
|
|
109
|
-
if (message.imageUrl) {
|
|
110
|
-
return [{
|
|
111
|
-
kind: 'image',
|
|
112
|
-
url: message.imageUrl,
|
|
113
|
-
}];
|
|
114
|
-
}
|
|
115
|
-
return [];
|
|
97
|
+
return Array.isArray(message.attachments) ? message.attachments : [];
|
|
116
98
|
}
|
|
117
99
|
export async function materializeAttachment(attachment, options) {
|
|
118
100
|
const path = buildCachePath({
|
package/dist/realtime.js
CHANGED
|
@@ -37,13 +37,16 @@ export class RealtimeManager {
|
|
|
37
37
|
isOwner: m.isOwner ?? false,
|
|
38
38
|
contentType: m.contentType ?? 'text',
|
|
39
39
|
text: m.text ?? null,
|
|
40
|
-
imageUrl: m.imageUrl ?? null,
|
|
41
|
-
audioUrl: m.audioUrl ?? null,
|
|
42
|
-
audioDurationMs: m.audioDurationMs ?? null,
|
|
43
40
|
attachments: m.attachments ?? [],
|
|
44
41
|
mentions: m.mentions ?? [],
|
|
45
42
|
replyTo: m.replyTo ?? null,
|
|
46
43
|
replyToPosition: m.replyToPosition ?? null,
|
|
44
|
+
...(m.forwarded === true || m.forwardedFrom
|
|
45
|
+
? { forwarded: true }
|
|
46
|
+
: {}),
|
|
47
|
+
...(m.forwardedFrom
|
|
48
|
+
? { forwardedFrom: m.forwardedFrom }
|
|
49
|
+
: {}),
|
|
47
50
|
status: 'sent',
|
|
48
51
|
deleted: false,
|
|
49
52
|
createdAt: m.createdAt ?? new Date().toISOString(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonmsg/agent-sdk",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Canon Agent SDK — build AI agents that participate in Canon conversations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"node": ">=18.0.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@canonmsg/core": "^0.7.
|
|
31
|
+
"@canonmsg/core": "^0.7.1"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|